Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*ElectroCrea.com
- Receptor Arduino
- ----------------------------
- VCC 5V
- GND GND
- OUT 12
- */
- #include <VirtualWire.h>//Incluimos esta librería
- int led = 13;
- ////////////////////////////////////////////////////////////////////VOID SETUP
- void setup(){
- vw_set_ptt_inverted(true);
- vw_set_rx_pin(12);//Pin de Arduino
- vw_setup(4000);//Velocidad de la transmisión de datos
- pinMode(led, OUTPUT);
- vw_rx_start();
- }
- ////////////////////////////////////////////////////////////////////VOID LOOP
- void loop(){
- uint8_t buf[VW_MAX_MESSAGE_LEN];
- uint8_t buflen = VW_MAX_MESSAGE_LEN;
- if (vw_get_message(buf, &buflen)){ //No bloqueada
- ////////////////////////////ACCION 1
- if(buf[0]=='1'){//Si recibimos 1
- digitalWrite(led,HIGH);//Se enciende el led
- }
- ////////////////////////////ACCION 2
- if(buf[0]=='2'){
- digitalWrite(led,LOW);//Se apaga el led
- }
- ////////////////////////////ACCION 3
- if(buf[0]=='3'){
- digitalWrite(led,LOW);//Parpadea el led
- delay (200);
- digitalWrite(led,HIGH);
- delay (200);
- }
- }
- }
- //Mas información en ElectroCrea.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement