i i have been asked to look at this for a friend, i do have some coding knowledge but not in this area, the product is fr my friends grandson, the error message above is being thrown after upload can someone please help me with this.
the error is in the last 5 lines of the code
// robot arm control hip, arm, forearm and grip
// using Arduino uno r3 and C program
void setup(){
const int hipPot=A0; // sets pin A0 as potentiometer control for hip movement
const int armPot=A1; // sets pin A1 as potentiometer control for arm movement
const int forearmPot=A2; // sets pin A2 as potentiometer control for forearm movement
const int gripPot=3; // sets pin A3 as potentiometer control for grip movement
const int hipMotor=9; // sets pin 9 as hip motor output
const int armMotor=6; // sets pin 6 as arm motor output
const int forearmMotor=5; // sets pin 5 as forearm motor output
const int gripMotor=3; // sets pin 3 as grip motor output
pinMode (hipPot,INPUT);
pinMode (armPot,INPUT);
pinMode (forearmPot,INPUT);
pinMode (gripPot,INPUT);
pinMode (hipMotor,OUTPUT);
pinMode (armMotor,OUTPUT);
pinMode (forearmMotor,OUTPUT);
pinMode (gripMotor,OUTPUT);
int val();
void loop();
Serial.begin(9600); // initialize serial communication at 9600 bits per sec
val = analogRead(hipPot); // reads the value of the hip potentiometer (value between 0 and 1023)
val = map(val,0,1023,0,179); // scale it to use it with the servo (value between 0 and 179 degrees)
hipMotor.write(val); // sets the servo position according to the scaled value hip motor
delay(15); // waits for the servo to get there
val = analogRead(armPot); // reads the value of the arm potentiometer (value between 0 and 1023)
val = map(val,0,1023,0,179); // scale it to use it with the servo (value between 0 and 179 degrees)
armMotor.write(val); // sets the arm servo position according to the scaled value
delay(15); // waits for the servo to get there
val = analogRead(forearmPot); // reads the value of the forearm potentiometer (value between 0 and 1023)
val = map(val,0,1023,0,179); // scale it to use it with the servo (value between 0 and 179 degrees)
forearmMotor.write(val); // sets the forearm servo position according to the scaled value)
delay(15); // waits for the servo to get there
[b]val = analogRead(gripPot); // reads the value of the grip potentiometer (value between 0 and 1023)
val = map(val,0,1023,0,90); // scale it to use it with the servo (value between 0 and 90 degrees)
gripMotor.write(val); // sets the grip servo position according to the scaled value
delay(15); // waits for the servo to get there
}
sketch_4_servo_drive.ino (2.71 KB)