Étape 2: Programmer votre Arduino
#include
#include
Servo myservo ;
int bluetoothTx = 10 ;
int bluetoothRx = 11 ;
SoftwareSerial bluetooth (bluetoothTx, bluetoothRx) ;
void setup()
{
myservo.Attach(9) ;
Configurer la connexion série usb pour ordinateur
Serial.Begin(9600) ;
Configurer la connexion série Bluetooth pour android
Bluetooth.Begin(9600) ;
}
void loop()
{
Lire bluetooth et écrire pour usb serial
if(Bluetooth.available() > 0)
{
int servopos = bluetooth.read() ;
Serial.println(servopos) ;
myservo.Write(servopos) ;
}
}