Quelqu'un pourrait me dire si ce programme parait fonctionnel ??
#include <SoftwareSerial.h>
#define RxD 4
#define TxD 5
#define PinMotorA 3
#define PinMotorB 11
#define DirectionMotorA 12
#define DirectionMotorB 13
SoftwareSerial blueToothSerial(RxD,TxD);
int recu;
void setup()
{
Serial.begin(9600);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
pinMode(PinMotorA,OUTPUT);
pinMode(PinMotorB,OUTPUT);
pinMode(DirectionMotorA,OUTPUT);
pinMode(DirectionMotorB,OUTPUT);
digitalWrite(PinMotorA,LOW);
digitalWrite(PinMotorB,LOW);
digitalWrite(DirectionMotorA,LOW);
digitalWrite(DirectionMotorB,LOW);
setupBlueToothConnection();
}
void loop()
{
while(1)
{
if(blueToothSerial.available())
{recu = blueToothSerial.read();
Serial.print(recu);
if(recu == 1)
{
digitalWrite(DirectionMotorA, HIGH);
digitalWrite(PinMotorA, 255);
delay(5400000);
digitalWrite(DirectionMotorA, LOW);
digitalWrite(PinMotorA, 0);
}
if(recu == 2)
{
digitalWrite(DirectionMotorA, HIGH);
digitalWrite(PinMotorA, 255);
delay(7200000);
digitalWrite(DirectionMotorA, LOW);
digitalWrite(PinMotorA, 0);
}
if(recu == 3)
{
digitalWrite(DirectionMotorA, HIGH);
digitalWrite(PinMotorA, 255);
delay(9000000);
digitalWrite(DirectionMotorA, LOW);
digitalWrite(PinMotorA, 0);
}
if(recu == 4)
{
digitalWrite(DirectionMotorA, HIGH);
digitalWrite(PinMotorA, 255);
delay(10800000);
digitalWrite(DirectionMotorA, LOW);
digitalWrite(PinMotorA, 0);
}
if(recu == 5)
{
digitalWrite(DirectionMotorA, HIGH);
digitalWrite(PinMotorA, 255);
delay(12600000);
digitalWrite(DirectionMotorA, LOW);
digitalWrite(PinMotorA, 0);
}
if(recu == 6)
{
digitalWrite(DirectionMotorA, HIGH);
digitalWrite(PinMotorA, 255);
delay(14400000);
digitalWrite(DirectionMotorA, LOW);
digitalWrite(PinMotorA, 0);
}
}
}
}
void setupBlueToothConnection()
{
blueToothSerial.begin(9600);
blueToothSerial.print("\r\n+STWMOD=0\r\n");
blueToothSerial.print("\r\n+STNA=HMSoft\r\n");
blueToothSerial.print("\r\n+STOAUT=1\r\n");
blueToothSerial.print("\r\n+STAUTO=0\r\n");
delay(2000);
blueToothSerial.print("\r\n+INQ=1\r\n");
Serial.println("The slave bluetooth is inquirable!");
delay(2000);
blueToothSerial.flush();
}