Hi There,Could you please help, I am using 2 HC12 TXRX where I am only Sending Data one way
sending a (distance ) value of 26 and on the receive side HC12read I am getting the values 50,54,13,10 repeating and noting the DEC value of 50 = 2 and 54 = 6, 13 = CR and 10 = LF whereas I only want the value of 26 seen in the receive program.
Attached are the relevant send/receive sketches whilst I realize there is a lot of extra lines in the sketches and are of possibly no use these are the result of trying different ways to do what I want and being a beginner.
Regards Doug
Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.
The technique in the 3rd example will be the most reliable.
You can send data in a compatible format with code like this
Thank you for your reply, I tried running the example 3 as a stand alone sketch and entered text in the serial monitor and all I got was the message Arduino is Ready and nothing else.
In my situation I am only dealing with numbers ,and the received number when converted (26) be called distance so that the rest of the program can use this value (26).
DougC:
Thank you for your reply, I tried running the example 3 as a stand alone sketch and entered text in the serial monitor and all I got was the message Arduino is Ready and nothing else.
Without knowing exactly what you entered in the serial monitor I can't help.
Hi again I think I have partly solved my problem, the value of" inString" is the value of distance from the Send Side but still need some help with line #55, could you please dot the i's and cross the T"s for me as I am at a loss of how to go about it.
"inString" is the distance value received by the "HC12" from the send sketch and I basicly want to replicate the send sketch in the receive sketch and to print on the serial monitor as well as the LCD.
I am at the desperate stage as I have spent many many hours to resolve my problem.
Your help would be greatly appreciated.
Doug
DougC:
Hi again I think I have partly solved my problem,
I don't see any evidence that you have incorporated one of the examples in my link in Reply #1. Of course you are not obliged to, but they do work well.
i am Sorry but I tried to my ability and could not get it to work for me, so went searching for other possibilities and that is what I came up with.
Regards Doug