Hello! I'm sorry I'm being kind of annoying in the past hour I've asked 3 questions... Anyway I'm trying to make it so when my potentiometer is at 5 volts then it will make the value -127 and when its at 0 volts it will make the value 127 But my mapping is not working correctly. My code: xvalue = map(pot1, 14, 127, 1023, -127);
How is xvalue declared ?
It works better but still not properly
In the beginning of the code I have byte xvalue;
hi
How is it working now?
Which value list with 0V and which list with 5V?
RV mineirin
byte are unsigned.
Oops
This may sound stupid but what does that mean
Can an Arduino byte variable ever have a negative value ?
Ok so I'm making a steering wheel using the joystick library and if the potentiometers value is 14 then xvalue will be 127 and if the potentiometers value is 1023 then it will be -127
I hope so
@ruilviana @anon73444976 @UKHeliBob Ok I figured it out. Byte values cannot go into negatives. Thank you all for the help!
That map() command is wrong anyway. As written it says "given a value between 14 and 127 map it to a range of 1023 to -127"
Is that what you really want ?
It's ok I figured it out. Thanks!
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.