Created
October 8, 2019 11:16
-
-
Save RobolinkAkademi/41535131090052226db8f7ca3a910280 to your computer and use it in GitHub Desktop.
arduino_hm_trlr_s_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 2 | |
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)) | |
{ | |
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)) | |
{ | |
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