Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Programa : Modulo Arduino Bluetooth HC-05 - Recepcao
- //Armazena o caracter recebido
- char buf;
- void setup()
- {
- //Define o pino 13 como saida
- pinMode(13, OUTPUT);
- Serial.begin(38400);
- }
- void loop()
- {
- while(Serial.available() > 0)
- {
- buf = Serial.read();
- //Caso seja recebido o caracter L, acende o led
- if (buf == 'L')
- {
- digitalWrite(13, HIGH);
- }
- //Caso seja recebido o caracter D, apaga o led
- if (buf == 'D')
- {
- digitalWrite(13, LOW);
- }
- }
- {
- //Envia pela serial o caracter F
- Serial.print("F");
- delay(3000);
- //Envia pela serial o caracter G
- Serial.print("G");
- delay(3000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement