The project it self is done, but I don't now what is wrong with the program.
Link:
#include <Servo.h>
int Main;
int motorB;
int motorP;
Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;
Servo motor5;
int alt;
//botao
int buto1;
int buto2;
int buto3;
int buto4;
int buto5;
//potenciometro
int pote1 = 0;
int pote2 = 0;
int pote3 = 0;
int pote4 = 0;
int pote5 = 0;
void setup() {
pinMode(7, INPUT);
motor1.attach(2);
motor2.attach(3);
motor3.attach(4);
motor4.attach(5);
motor5.attach(6);
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
}
void loop() {
goto Main;
Main:
alt = digitalRead(7);
if (alt = HIGH) {
goto motorB;
}
if (alt = LOW) {
goto motorP;
}
goto Main;
motorB:
buto1 = digitalRead(8);
if (buto1 == LOW) {
motor1.write(0);
}
else {
motor1.write(180);
}
buto2 = digitalRead(9);
if (buto2 == LOW) {
motor2.write(0);
}
else {
motor2.write(180);
}
buto3 = digitalRead(10);
if (buto3 == LOW) {
motor3.write(0);
}
else {
motor3.write(180);
}
buto4 = digitalRead(11);
if (buto4 == LOW) {
motor4.write(0);
}
else {
motor4.write(180);
}
buto5 = digitalRead(12);
if (buto5 == LOW) {
motor5.write(0);
}
else {
motor5.write(180);
}
if (alt = HIGH) {
goto motorB;
}
else {
goto Main;
}
motorP:
pote1 = analogRead(A1);
int pos1 = map(pote1, 0, 1023, 0 , 180);
motor1.write(pos1);
pote2 = analogRead(A2);
int pos2 = map(pote2, 0, 1023, 0 , 180);
motor2.write(pos2);
pote3 = analogRead(A3);
int pos3 = map(pote3, 0, 1023, 0 , 180);
motor3.write(pos3);
pote4 = analogRead(A4);
int pos4 = map(pote4, 0, 1023, 0 , 180);
motor4.write(pos4);
pote5 = analogRead(A5);
int pos5 = map(pote5, 0, 1023, 0 , 180);
motor5.write(pos5);
if (alt = LOW) {
goto motorP;
}
else {
goto Main;
}
}