daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Feb 24th, 2018 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  #include <SoftwareSerial.h>
  2.  
  3. SoftwareSerial HC06(11,10);
  4. const char DOUT_LED =12;
  5. String message;
  6.  
  7. void setup(){
  8. Serial.begin(9600);
  9. HC06.begin(9600);
  10. pinMode(DOUT_LED,OUTPUT);
  11. digitalWrite(DOUT_LED,LOW);
  12. }
  13.  
  14. void loop()
  15. {
  16. while(HC06.available())
  17. {
  18. delay(3);
  19. char c = HC06.read();
  20. message += c;
  21. }
  22. if (message.length()>0)
  23. {
  24. Serial.println(message);
  25. if (message == "LED:1")
  26. {digitalWrite(DOUT_LED,HIGH);}
  27. if (message =="LED:0")
  28. {digitalWrite(DOUT_LED,LOW);}
  29. message="";
  30. }
  31. }
  32. GĂ©rer
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top