1 Arduino Nano with 2 Motors, how?

Hi,

map is used in the analogRead to analogWrite conversion.
analogRead is 10bits 0 to 1023
analogWrite is 8bits 0 to 255

map function

val = map(inval, 0, 1023, 0, 255);

inval =0 val = 0
inval = 1023 val = 255

and all values in between of inval gives a proportional value of val.
The function only works with integer values.

by the way inval = -1023 will give val = -255, there are no constraints to values so inval can be <0 or >255 and map will continue to calculate new val.

Tom.... :slight_smile: