Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://ingenieroaburrido.com
- #define rfReceivePin A0 //RF Receiver pin = pin analógico 0
- #define ledPin 13 //LED de la arduino = digital pin 13
- unsigned int data = 0; // variable usada para almacenar los datos.
- const unsigned int upperThreshold = 50; //upper threshold value
- const unsigned int lowerThreshold = 50; //lower threshold value
- void setup(){
- pinMode(ledPin, OUTPUT);
- Serial.begin(9600);
- }
- void loop(){
- data=analogRead(rfReceivePin); //esperando a recibir datos por el pin analógico...
- if(data>upperThreshold){
- digitalWrite(ledPin, HIGH); //Si la señal es alta, encendemos el LED
- Serial.println(data);
- }
- if(data<lowerThreshold){
- digitalWrite(ledPin, LOW); //Si la señal es baja, apagamos el LED
- Serial.println(data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment