Advertisement
bladatwarz6

Untitled

Nov 13th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <VirtualWire.h>
  2.  
  3. void setup()
  4. {
  5.   Serial.begin(9600);     // Debugging only
  6.   Serial.println("Wpisz cos: ");
  7.   // Initialise the IO and ISR
  8.   vw_set_ptt_inverted(true); // Required for DR3100
  9.   vw_setup(2000);    // Bits per sec
  10. }
  11.  
  12. void loop()
  13. {
  14.   char TestData;
  15.  
  16.   if(Serial.available() )
  17.   {
  18.     TestData = Serial.read();
  19.     Serial.print (TestData);  // echo the incoming character to the LCD
  20.    
  21.     const char *msg = TestData;
  22.  
  23.     digitalWrite(13, true); // Flash a light to show transmitting
  24.     vw_send((uint8_t *)msg, strlen(msg));
  25.     vw_wait_tx(); // Wait until the whole message is gone
  26.     digitalWrite(13, false);
  27.     delay(200);
  28.   }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement