daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
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