Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.