Étape 7: Bluetooth
Le module bluetooth HC-05 a 4 broches, nous allons utiliser ; GND, 3v3, Tx et Rx. GND pour arduino GND, 3v3 pour arduino 3v3, Tx à broche Rx sur arduino et Rx à broche Tx sur arduino. Oui, ils sont censés pour aller comme ça. Et nous n’utilisons pas le deux extrémité points.
serialA octets ; programme d’installation à lire la communication série
void setup()
{
Serial.Begin(9600) ; bauds série
pinMode (1, sortie) ;
}
void loop() {}
if(Serial.available() > 0) / / si elle reçoit communication série, lisez-le
{
serialA = Serial.read() ;
Serial.println(serialA) ; communication série impression série
}
Si (serialA == ' o ') / / if commande série est o tour broche 1 en haut
{
digitalWrite (1, haut) ;
}
else / / si commande série n’est pas o, la broche 1 est faible
{
digitalWrite (1, faible) ;
}
}