#include<Servo.h>
Servo myServo;
int flexPin = A0; // analog input 0
int switchPin = 2; // digital input 2
void setup(){
myServo.attach(9); // connect myServo to pin digital pin 9
pinMode(switchPin, INPUT); // set my switch as an input
}
void loop(){
int flexVal = analogRead(flexPin);
flexVal = map (0, 1023, 0 ,179);
myServo.write(flexVal);
}
keeps saying error and highlighting "flexVal = map (0, 1023, 0 179)
im srry it actually says
"C:\Program Files\arduino extracted files\arduino-1.0.4\hardware\arduino\cores\arduino/Arduino.h:209: error: too few arguments to function 'long int map(long int, long int, long int, long int, long int)'
sketch_may16b:20: error: at this point in file"
I am very new to all this so if you could explain what exactly this means I would really appreciate the help
In looking at the cpp code, it appears that the map() function takes 5 arguments, not 4.
thank you that makes sense. I changed it to
void loop(){
int flexVal = analogRead(flexPin);
flexVal = map (flexVal, 0, 1023, 0 ,179);
myServo.write(flexVal);
}
and it worked.
I appreciate the help thank u