trying to map my pots as they only give me a short range of the dial ie the pot works from 7 to 8 oclock and the rest of the pot range does not give any value,
v2_1sketch_NesArduinomappmodded.pde (6.8 KB)
trying to map my pots as they only give me a short range of the dial ie the pot works from 7 to 8 oclock and the rest of the pot range does not give any value,
v2_1sketch_NesArduinomappmodded.pde (6.8 KB)
Are they linear taper pots, or log/audio?
You need to use the map() function where things are actually happening, not in the initialization of the variables.
And you don't seem to use output0Value anywhere ! ? !
This should work, if placed at the right spot (assuming the hardware is wired up correctly):
sensor0Value = map(analogRead(sensor0Pin), 0, 1023, 0, 127);
they are linear pots
madworm is right, you aren't using map() properly, but you don't need to use map() just to divide by eight.
This
sensor0Value = analogRead(sensor0Pin) / 8;
will work just as well.
cant get it to work im ready to give up
Ok, thanks for letting us know.
but i aint im just frustrated as its for a uni project and its due in very soon. when i removed the map funcs and devided the pots by 8 as was said in previous reply i get the same problem as before nothing changes
any and all help is greatly appreciated
Any and all details greatly appreciated.
when i removed the map funcs and devided the pots by 8 as was said in previous reply i get the same problem as before nothing changes
As has already been pointed out, the "map" functions were in the wrong place, so replacing them with any operation whatsoever would not have made any difference.
The "map" does not bind in some magical way to a variable when you declare it, you have to call the function when you want it to act on a variable.
Bearing in mind that I know virtually nothing about MIDI, can you explain what happened to controllers 0x0a, 0x0b, 0x0c, 0x0d 0x0e and 0x0f here:
sensor2Value = controlChange(0xB0, sensor2Pin, sensor2Value, 0x09); // VOLUME
sensor3Value = controlChange(0xB0, sensor3Pin, sensor3Value, 0x10); // VOLUME
or does MIDI use BCD (Binary Coded Decimal) ?
Re-posting your code wouldn't hurt either.
Just throwing that out there.......
I think that's covered by "any and all details"