Created
October 8, 2019 11:06
-
-
Save RobolinkAkademi/4b800636c8ed69c01b0daf199ba44d45 to your computer and use it in GitHub Desktop.
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