Created
October 8, 2019 11:06
arduino_hm_trlr_dw_433mhz_rf_transmitter
This file contains 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
#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