Advertisement
thomazrb

HC-08

Nov 17th, 2017
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. SoftwareSerial bluetooth(2, 3);
  4.  
  5. void setup() {
  6.   Serial.begin(9600);
  7.   bluetooth.begin(9600);
  8. }
  9.  
  10. void loop() {
  11.   if (Serial.available()) {
  12.     char r = Serial.read();
  13.     bluetooth.print(r);
  14.   }
  15.  
  16.   if (bluetooth.available()) {
  17.   Serial.println("Chegou algo!");
  18.   char r = bluetooth.read();
  19.   Serial.print(r);
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement