Created
April 23, 2025 04:57
-
-
Save johnaboxall/35eb7af8afa9bfa63d13d9b99c7c2372 to your computer and use it in GitHub Desktop.
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
// receiver sketch | |
// | |
#include <VirtualWire.h> | |
uint8_t buf[VW_MAX_MESSAGE_LEN]; | |
uint8_t buflen = VW_MAX_MESSAGE_LEN; | |
void setup() | |
{ | |
vw_set_ptt_inverted(true); // Required for RF link modules | |
vw_setup(300); | |
vw_set_rx_pin(11); | |
vw_rx_start(); | |
pinMode(3, OUTPUT); | |
pinMode(2, OUTPUT); | |
} | |
void loop() | |
{ | |
if (vw_get_message(buf, &buflen)) | |
{ | |
switch(buf[0]) | |
{ | |
case 'a': | |
digitalWrite(2, HIGH); | |
break; | |
case 'b': | |
digitalWrite(2, LOW); | |
break; | |
case 'c': | |
digitalWrite(3, HIGH); | |
break; | |
case 'd': | |
digitalWrite(3, LOW); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment