arduino, eletrônica, robotica...
Conecto o HC-06 RXD no pino 6 do arduino mega, e TXD no pino 7 do mega
#include <SoftwareSerial.h>int bluetoothTx = 7;int bluetoothRx = 6;int led = 13;
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup() {bluetooth.begin(9600);pinMode(led, OUTPUT);Serial.begin(9600);digitalWrite(led,0);
}void loop() {
if(bluetooth.available()>0){unsigned int blue = bluetooth.read();
if(blue == 100){
Serial.println("Liga");delay(100);}if(blue == 200){
Serial.println("Desliga");delay(250);}
}}
Tags:
MySpace Tweet Facebook Facebook
Exibições: 134
▶ Responder esta
RSS
Bem-vindo aLaboratorio de Garagem (arduino, eletrônica, robotica, hacking)
Registre-seou acesse
Or sign in with:
© 2024 Criado por Marcelo Rodrigues. Ativado por
Badges | Relatar um incidente | Termos de serviço
Verifique as configurações do seu navegador ou contate o administrador do sistema.