Papermind

Transmit

Dec 28th, 2017
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <VirtualWire.h>
  2.  
  3. const int led_pin = 13;
  4. const int transmit_pin = 12;
  5. void setup()
  6. {
  7.     // Initialise the IO and ISR
  8.     vw_set_tx_pin(transmit_pin);
  9.     vw_set_ptt_inverted(true); // Required for DR3100
  10.     vw_setup(2000);       // Bits per sec
  11.     pinMode(led_pin, OUTPUT);
  12. }
  13.  
  14. void loop() {
  15.   char msg[7] = {'n','g','o','p','i','n','i'};
  16.   digitalWrite(led_pin, HIGH); // Flash a light to show transmitting
  17.   vw_send((uint8_t *)msg, 7);
  18.   vw_wait_tx(); // Wait until the whole message is gone
  19.   digitalWrite(led_pin, LOW);
  20.   delay(1000); }
Advertisement
Add Comment
Please, Sign In to add comment