Kodlarım ve bağlantılarım bu şekilde ama 19.2 değerini esp8266 kartında göremiyorum
Sipariş No: 6526828
// Nano Kod //<br />#include \"LoRa_E32.h\"<br />#include <SoftwareSerial.h><br />SoftwareSerial mySerial(10, 11); // Arduino RX <-- e32 TX, Arduino TX --> e32 RX<br />LoRa_E32 e32ttl(&mySerial);<br /> struct Signal {<br /> char type[15];<br /> byte temp[4];<br />} data;<br /> void setup() {<br /> Serial.begin(9600);<br /> e32ttl.begin();<br /> delay(500);<br />}<br /> void loop() {<br /> while (e32ttl.available() > 1) {<br /> // Gelen mesaj okunuyor<br /> ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Signal));<br /> struct Signal data = *(Signal*) rsc.data;<br /> Serial.print(\"Gelen Messaj: \");<br /> Serial.println(data.type);<br /> rsc.close();<br /> //Gönderilecek paket veri hazırlanıyor<br /> struct Signal {<br /> char type[15] = \"Bebek Odası\";<br /> byte temp[4];<br /> } data2;<br /> *(float*)(data2.temp) = 19.2;<br /> ResponseStatus rs = e32ttl.sendFixedMessage(0, 1, 20, &data2, sizeof(Signal));<br /> Serial.println(rs.getResponseDescription());<br /> }<br /> }
//Esp8266 Nodemcu //<br />#include \"LoRa_E32.h\"<br />#include <SoftwareSerial.h><br /> SoftwareSerial mySerial(D2, D3);<br /> /*<br /> Pinler Arduino Nano Lora E32 433T20d<br /> 11 3<br /> 10 4<br />*/<br /> LoRa_E32 e32ttl(&mySerial);<br /> struct Signal {<br /> char type[15] = \"Fixaj.com\";<br /> byte temp[4];<br />} data;<br /> void setup() {<br /> Serial.begin(9600);<br /> e32ttl.begin();<br /> delay(500);<br />}<br /> void loop() {<br /> ResponseStatus rs = e32ttl.sendFixedMessage(0, 2, 20, &data, sizeof(Signal));<br /> Serial.println(rs.getResponseDescription());<br /> delay(2000);<br /> while (e32ttl.available() > 1) {<br /> ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Signal));<br /> struct Signal data = *(Signal*) rsc.data;<br /> Serial.print(\"Yer: \");<br /> Serial.println(data.type);<br /> Serial.print(\"Ortam Sıcaklığı: \");<br /> Serial.println(*(float*)(data.temp));<br /> rsc.close();<br /> }<br />}
Soru yeni cevaplara kapalıdır.
Mehmet En iyi cevap olarak seçildi Aralık 19, 2022
// Nano Kod // #include "LoRa_E32.h" #include <SoftwareSerial.h> SoftwareSerial mySerial(10, 11); // Arduino RX <-- e32 TX, Arduino TX --> e32 RX LoRa_E32 e32ttl(&mySerial); struct Signal { char type[15]; byte temp[4]; } data; void setup() { Serial.begin(9600); e32ttl.begin(); delay(500); } void loop() { while (e32ttl.available() > 1) { // Gelen mesaj okunuyor ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Signal)); struct Signal data = *(Signal*) rsc.data; Serial.print("Gelen Messaj: "); Serial.println(data.type); rsc.close(); //Gönderilecek paket veri hazırlanıyor struct Signal { char type[15] = "Bebek Odası"; byte temp[4]; } data2; *(float*)(data2.temp) = 19.2; ResponseStatus rs = e32ttl.sendFixedMessage(0, 1, 20, &data2, sizeof(Signal)); Serial.println(rs.getResponseDescription()); } }
//Esp8266 Nodemcu // #include "LoRa_E32.h" #include <SoftwareSerial.h> SoftwareSerial mySerial(0, 4); /* Pinler Arduino Nano Lora E32 433T20d 11 3 10 4 */ LoRa_E32 e32ttl(&mySerial); struct Signal { char type[15] = "Fixaj.com"; byte temp[4]; } data; void setup() { Serial.begin(9600); e32ttl.begin(); delay(500); } void loop() { ResponseStatus rs = e32ttl.sendFixedMessage(0, 2, 20, &data, sizeof(Signal)); Serial.println(rs.getResponseDescription()); delay(2000); while (e32ttl.available() > 1) { ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Signal)); struct Signal data = *(Signal*) rsc.data; Serial.print("Yer: "); Serial.println(data.type); Serial.print("Ortam Sıcaklığı: "); Serial.println(*(float*)(data.temp)); rsc.close(); } }
furkanemir Cevaplanan soru Aralık 10, 2022