Browse Source

arduino files

master
fanta 3 months ago
parent
commit
318ff34fbf
2 changed files with 34 additions and 0 deletions
  1. +15
    -0
      receive.arduino.ino
  2. +19
    -0
      send.arduino.ino

+ 15
- 0
receive.arduino.ino View File

@@ -0,0 +1,15 @@
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
}

void loop() {
if (mySwitch.available()) {
output(mySwitch.getReceivedValue(), mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(), mySwitch.getReceivedRawdata(),mySwitch.getReceivedProtocol());
mySwitch.resetAvailable();
}
}

+ 19
- 0
send.arduino.ino View File

@@ -0,0 +1,19 @@
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

Serial.begin(9600);
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);
}

void loop() {

/* using binary code */
mySwitch.send("01100101 01111000 01101010");
delay(100);
}

Loading…
Cancel
Save