Last active
January 4, 2016 11:14
-
-
Save aweijnitz/0aa06fff304b428cecbe to your computer and use it in GitHub Desktop.
RF Link 433MHz debug setup for Arduino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic Aruino sketch to dump received RF signal, together with some rudimentary hysterisis/filtering | |
// RF Link pinouts: http://www.seeedstudio.com/wiki/433Mhz_RF_link_kit | |
#define rfRECEIVE A0 //RF Receiver pin = Analog pin 0 | |
const int RXLED = 13; // internal LED | |
unsigned int data = 0; // variable used to store received data | |
const unsigned int upperThreshold = 700; //upper threshold value | |
const unsigned int lowerThreshold = 300; //lower threshold value | |
void setup() | |
{ | |
pinMode(RXLED, OUTPUT); | |
Serial.begin(9600); | |
} | |
boolean state = false; | |
void loop() | |
{ | |
data = analogRead(rfRECEIVE); | |
if (data > upperThreshold) { | |
digitalWrite(RXLED, LOW); | |
Serial.print(data); | |
Serial.println(" - LOW"); | |
} | |
if (data < lowerThreshold) { | |
digitalWrite(RXLED, HIGH); | |
Serial.print(data); | |
Serial.println(" - HIGH"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Transmit HIGH for 1s, then LOW for 1s, then HIGH, etc | |
const int TRANSMITTER = PD4; // Transmitter data pin on digital pin 4 | |
const int TXLED = 13; // internal LED | |
void setup() | |
{ | |
pinMode(TRANSMITTER, OUTPUT); | |
pinMode(TXLED, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
transmit(); | |
delay(1000); | |
} | |
void transmit() { | |
digitalWrite(TRANSMITTER, HIGH); | |
digitalWrite(TXLED, HIGH); | |
delay(1000); | |
digitalWrite(TRANSMITTER, LOW); | |
digitalWrite(TXLED, LOW); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment