SHARE
TWEET

VirtualWire.SimpleReceive

a guest Mar 27th, 2014 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. SimpleReceive
  3. This sketch displays text strings received using VirtualWire
  4. Connect the Receiver data pin to Arduino pin 11
  5. */
  6. #include <VirtualWire.h>
  7. byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
  8. byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
  9. void setup()
  10. {
  11. Serial.begin(9600);
  12. Serial.println("Device is ready");
  13. // Initialize the IO and ISR
  14. vw_setup(2000); // Bits per sec
  15. vw_rx_start(); // Start the receiver
  16. }
  17. void loop()
  18. {
  19. if (vw_get_message(message, &messageLength)) // Non-blocking
  20. {
  21. Serial.print("Received: ");
  22. for (int i = 0; i < messageLength; i++)
  23. {
  24. Serial.write(message[i]);
  25. }
  26. Serial.println();
  27. }
  28. }
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