I’m trying to do a project where I tell my sender E32 which receiver address it will send the message to. I give the address info via serial monitor. I ask the user to provide the ADDH, ADDL, CHAN bytes.
For example I give the ADDH=0 ADDL=0 and CHAN=17 and pass these into sendFixedMessage as parameters.
But when the sender sends to this address, the receiver gives overflows and data get messed up since I can’t write the CHAN byte as 0x17.
I’ve tried writing it as, ResponseStatus wakeMes = e32ttl.sendFixedMessage(ADDH,ADDL,Serial.print(23,HEX), "Sensor Data");
but it again gave overflow and data got messed up.
Is there any other way that I can store the serial byte input as hex and then pass it into sendFixedMessage function as address parameter?
I’ve tried doing this, byte b =Serial.println(a,HEX); Serial.println(b);
but again, it always turned something incorrect.
Or is there any other way that I could play with your library to make the sendFixedMessage function to accept the user input byte without writing it as 0xCHAN?
I do some change (set WAKE UP mode to sent do the receiver) and I set channel to 4 (but I test It with 17 also with send 23 that in HEX is 17) and works correctly the first handshake.
----------------------------------------HEAD : 11000000 192 C0AddH : 0AddL : 2Chan : 4 -> 414MHzSpeedParityBit : 0 -> 8N1 (Default)SpeedUARTDatte : 11 -> 9600bps (default)SpeedAirDataRate : 10 -> 2.4kbps (default)OptionTrans : 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)OptionPullup : 1 -> TXD, RXD, AUX are push-pulls/pull-ups OptionWakeup : 0 -> 250ms (default)OptionFEC : 1 -> Turn on Forward Error Correction Switch (Default)OptionPower : 0 -> 20dBm (Default)----------------------------------------Press any key to start conversation with any node at any time.Start listening!----------------------------------------HEAD : 11000000 192 C0AddH : 0AddL : 1Chan : 4 -> 414MHzSpeedParityBit : 0 -> 8N1 (Default)SpeedUARTDatte : 11 -> 9600bps (default)SpeedAirDataRate : 10 -> 2.4kbps (default)OptionTrans : 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)OptionPullup : 1 -> TXD, RXD, AUX are push-pulls/pull-ups OptionWakeup : 0 -> 250ms (default)OptionFEC : 1 -> Turn on Forward Error Correction Switch (Default)OptionPower : 0 -> 20dBm (Default)----------------------------------------Press any key to start conversation with any node at any time.Start listening!>>Send to COM3: "0"<<----------------------------------------Now you are in interrupt mode.First, tell me the node adress you want to talk toEnter the ADDH in decimal>>Send to COM3: "0"<<ADDH: 0Enter the ADDL in decimal>>Send to COM3: "1"<<ADDL: 1Enter the CHAN in hex>>Send to COM3: "4"<<CHAN: 4Your adress is: 014Press 1 if you want to wake the node up and fetch the sensor data, press 2 to see the sleep schedule..>>Send to COM3: "1"<<Sending message to wake the node up!Success----------------------------------------Data is coming thru.. Coming from -> 014Temperature -> 18.91°CHumidity -> 67.89Pressure -> 1234Light intensity -> 433Current battery state -> 0Sending confirmation info to the sender..Success
I used 2 arduino UNO (with my shield) but no overflow.
I can’t quite understand what you have changed in your code Renzo. Can you please give me some more details about the changes you made?
I have solved the problem by defining bunch of (32 to be exact, because there are 32 channels as you know) hex values such as
#define chan0 0x0
#define chan23 0x17
….
#define chan32 0x1F
And wrote a swith case for each one of those. 32 switch cases look terrible I know, but I had no choice. I’m going to be presenting my work next week, so whatever works I have to use it right now. But in the future, I’ll definitely look for a solution with a cleaner code.
I had another problem with your sendFixedMessage function earlier this week. I want to be able to set or change the sleep time wirelessly whenever I want. So I need to send an int or a byte data to the receiver for this and I don’t want to set up a structure for one small piece of data. So I tried turning my byte data to String so that I could send it as normal String message. But it didn’t accept it since it wasn’t written explicitly inside the quotation mark. So I had to set up another 32 switch cases for each sleep option I have, such as 1 minute, 15 minutes and 30 minutes.
So I ended up having 4 set of switch cases with 32 items inside each of them because of the inconvenience caused by the sendFixedMessage function. The code works but there’s gotta be some other way.
If you have any ideas on how I can do all these without writing hundred lines of hideous switch cases please let me know.
Thanks again for your work tho. If it wasn’t for it, I wouldn’t be able to finish my project.
as you can see in the file at line 228 I add e32ttl.setMode(MODE_1_WAKE_UP); than I use simple Int value to set ADDH, ADDL and CHAN (I print the HEX value to check the channel).
I don’t have problem to use decimal value instead HEX.
Maintaining a repository (or site or forum) is a lot like tending to a garden - it requires constant care and attention to keep it thriving. If you're a skilled gardener (or coder!) and want to help keep our repository blooming, we'd love to have you on board! We're also looking for talented writers and forum moderators to help us grow our community. Interested in joining our team? Don't hesitate to reach out and let us know how you can contribute!
Are you a fan of electronics or programming? Share your knowledge with others, write a simple tutorial or how to make a great project Contact me: share_your_ideas@mischianti.org
The content displayed on this website is protected under a CC BY-NC-ND license. Visitors are prohibited from using, redistributing, or altering any content from this website for commercial purposes, including generating revenue through advertising. Any unauthorized use is a violation of the license terms and legal action may be taken against individuals or entities found to be in violation.
You must also provide the link to the source.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.