Advertisement
computermuseo

ricevitore 433Mhz arduino

May 8th, 2015
2,594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <VirtualWire.h>
  2. void setup()
  3. {
  4. vw_set_ptt_inverted(true); // Required for DR3100
  5. vw_set_rx_pin(12);
  6. vw_setup(4000); // Bits per sec
  7. pinMode(13, OUTPUT);
  8.  
  9. vw_rx_start(); // Start the receiver PLL running
  10. }
  11. void loop()
  12. {
  13. uint8_t buf[VW_MAX_MESSAGE_LEN];
  14. uint8_t buflen = VW_MAX_MESSAGE_LEN;
  15.  
  16. if (vw_get_message(buf, &buflen)) // Non-blocking
  17. {
  18. if(buf[0]=='1'){
  19.  
  20.  
  21. digitalWrite(13,1);
  22. }
  23. if(buf[0]=='0'){
  24. digitalWrite(13,0);
  25. }
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement