bonjour a tous
j'ai un probleme avec mon programme arduino lorsque je rajoute des elements dans mon programme qui permet de faire roulet un robot depuis une application via smartphone en bleutooth ,arduino m'affiche "Etape 1" was not declared in the scope" quelqu'un aurait il une solution merci
int E1 = 5;
int E2 = 6;
int M1 = 4;
int M2 = 7;
char BluetoothData;
char BluetoothData1;
void setup(){
Serial1.begin(9600);
pinMode(13,OUTPUT);
}
void loop() { // On va creer plusieurs étapes afin de mieux organiser les évenements qui se suivent.
if(Serial1.available())
{
char BluetoothData = Serial1.read();
if(BluetoothData== 'J'){ //on va dans la boucle chenille manuelle
Etape1();
exit(0);
}
else if(BluetoothData== 'L'){ //on va dans la boucle roue manuelle
}
exit(0);
}
else
if(BluetoothData== 'I'){ //on va dans la boucle chenille auto
exit(0);
}
else if(BluetoothData== 'K'){ //on va dans la boucle roue auto
exit(0);
}
}
}
///////////////////////// BOUCLE CHENILLE MANUELLE //////////////////////////////////
void Etape1()
{
if(Serial1.available())
{digitalWrite(13,HIGH);
delay(3000);
char BluetoothData1 = Serial1.read();
if(BluetoothData1== 'A') {
analogWrite (E1, 255);
digitalWrite(M1, HIGH);
analogWrite (E2, 255);
digitalWrite(M2, HIGH);
}
else if(BluetoothData1== 'R') {
//reculer();
}
else if(BluetoothData1== 'D') {
//droite();
}
else if(BluetoothData1== 'G') {
//gauche();
}
else if (BluetoothData== 'S') {
//stop1();
}
}
}
void avancer() {
analogWrite (E1, 255);
digitalWrite(M1, HIGH);
analogWrite (E2, 255);
digitalWrite(M2, HIGH);
}
void reculer()
{
analogWrite (E1, 255);
digitalWrite(M1, LOW);
analogWrite (E2, 255);
digitalWrite(M2, LOW);
}
void droite()
{
analogWrite (E1, 255);
digitalWrite(M1, HIGH);
analogWrite (E2, 255);
digitalWrite(M2, LOW);
}
void gauche()
{
analogWrite (E1, 255);
digitalWrite(M1, LOW);
analogWrite (E2, 255);
digitalWrite(M2, HIGH);
}
void stop1()
{
analogWrite (E1, 0);
digitalWrite(M1, HIGH);
analogWrite (E2, 0);
digitalWrite(M2, HIGH);
}
void Etape2()
{
}
///////////////////////// BOUCLE CHENILLE AUTO //////////////////////////////////
void Etape3()
{
}
///////////////////////// BOUCLE ROUE AUTO //////////////////////////////////
void Etape4()
{
}
robot.ino (2.1 KB)