Guest User

Untitled

a guest
Mar 13th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <VirtualWire.h>
  2.  
  3. const int transmit_pin = 4;
  4.  
  5.  
  6. void setup()
  7. {
  8. Serial.begin(9600); // Baud Rate
  9. vw_set_tx_pin(transmit_pin);
  10. vw_setup(2000); // Bits per sec
  11. }
  12.  
  13.  
  14. void loop()
  15. {
  16.  
  17. while(Serial.available()) {
  18. String message = Serial.readString();
  19. int size = message.length() + 1;
  20. char copy[size];
  21. message.toCharArray(copy, size);
  22. vw_send((uint8_t *)copy, size);
  23. vw_wait_tx();
  24.  
  25. }
  26.  
  27. delay(1000);
  28.  
  29. }
Add Comment
Please, Sign In to add comment