I'm sure someone must have done something like this before (i'm sure i have too at some point but cant remember), anyways. I'm working on a project for home (no i'm not a student) which involves using an analog to digital converter hooked up to my PC. Now I want (in visual basic) an analog gauge and a digital gauge (the analog is done).
OK, my AD input range is 0 - 255, I want to make a value of 0 to return a value of -20 and a value of 255 to return a value of +20, therefore a value of 126.5 to give a value of 0. I can do this if it were ranging from 0 upwards as it's just straightforward division but havnt a clue how to do it where the returned values are +/- figures. I just cant figure what maths are involved to return the correct values.
Any help would be greatly appreciated.
OK, my AD input range is 0 - 255, I want to make a value of 0 to return a value of -20 and a value of 255 to return a value of +20, therefore a value of 126.5 to give a value of 0. I can do this if it were ranging from 0 upwards as it's just straightforward division but havnt a clue how to do it where the returned values are +/- figures. I just cant figure what maths are involved to return the correct values.
Any help would be greatly appreciated.