Advertisement
Guest User

RadioBlock Arduino Example

a guest
Sep 15th, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2. #include <RadioBlock.h>
  3.  
  4. //Pins connected to RadioBlock pins3/4, VCC/GND connected externally
  5. RadioBlockSerialInterface radio = RadioBlockSerialInterface(-1,-1,3,2);
  6.  
  7. uint8_t data[] = {2};
  8.  
  9. void setup()  
  10. {
  11.   radio.begin();  
  12.   Serial.begin(9600);
  13.   Serial.println("Starting...");
  14.  
  15.   pinMode(13, INPUT_PULLUP);
  16.   pinMode(12, INPUT_PULLUP);
  17.  
  18.   //Set up this device
  19.   //radio.setAddress(0x0001);
  20.   //radio.setChannel(25);  
  21.  
  22. }
  23.  
  24. void loop() // run over and over
  25. {
  26.   //Turn on our LED      
  27.   if (digitalRead(13) == LOW) {
  28.       radio.sendData(0xBAAD, 1);
  29.       radio.setLED(true);
  30.   }
  31.  
  32.   if (digitalRead(12) == LOW) {
  33.       radio.sendData(0xBAAD, 2);
  34.       radio.setLED(true);
  35.   }
  36.  
  37.   //wait
  38.   delay(1000);  
  39.   radio.setLED(false);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement