Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RobolinkAkademi/4b800636c8ed69c01b0daf199ba44d45 to your computer and use it in GitHub Desktop.
Save RobolinkAkademi/4b800636c8ed69c01b0daf199ba44d45 to your computer and use it in GitHub Desktop.
arduino_hm_trlr_dw_433mhz_rf_transmitter
#include <HRFMessage.h>
HRFMessage server(&Serial1);
#define buton 4
void setup()
{
pinMode(buton, INPUT);
Serial.begin(9600);
Serial1.begin(9600);
}
void loop()
{
uint8_t buf[HRF_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
int buton1 = digitalRead(buton);
if (buton1 == 1)
{
if (server.recv((uint8_t*)&buf, &len))
{
// Got a message from the client.
// Send a reply back
server.send((uint8_t*)"Led Yak\n", 9);
Serial.print("Alinan: ");
Serial.println((const char*)buf);
}
}
if (buton1 == 0)
{
if (server.recv((uint8_t*)&buf, &len))
{
// Got a message from the client.
// Send a reply back
server.send((uint8_t*)"Led Sondur\n", 12);
Serial.print("Alinan: ");
Serial.println((const char*)buf);
}
}
delay(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment