-2

enter image description here

Arduino: 1.8.5 (Windows 8.1), Board: "Arduino/Genuino Uno"

C:\Users\julie_000\Documents\Arduino\BIO_199\BIO_199.ino: In function 'void loop()':

BIO_199:19: error: too few arguments to function 'long int map(long int, long int, long int, long int, long int)'

   t1 = map(2, 0, 1023, 2);

                         ^

In file included from sketch\BIO_199.ino.cpp:1:0:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:253:6: note: declared here

 long map(long, long, long, long, long);

      ^

exit status 1
too few arguments to function 'long int map(long int, long int, long int, long int, long int)'

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

How do I fix this error?

  • 5
    Use formatting! And don't post pictures of code! – MatsK Mar 29 '18 at 17:24
4

map takes 5 parameters, not 4. You have the original lower and upper bounds, the desired lower and upper bounds, but you forgot the actual value you want to map:

map(value, fromLow, fromHigh, toLow, toHigh)

So

t1 = map(t2, 2, 0, 1023, 2);

(assuming those numbers are actually meaningful...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.