I am using a very simple bit of code to write to a device and get the result back.
i.e. I send ?T and receive xx.xx CR NL
The code is working i.e. sending what I expect to the serial monitor but is this the best way to do?
25.3
25.3
24.4
etc. Which is correct but I want to send this result to a 4D systems touch screen LED DIGGITS by changing the last line to genieWriteObject(GENIE_OBJ_LED_DIGGITS,0x00,num x 100)
Hope above makes sense
//write to a LED digits
genieWriteStr(3, "Leddigits0 at \nvarious states");
for(i = 0; i < 100; i++){
genieWriteObject(GENIE_OBJ_LED_DIGITS, 0x00, i);
delay(100);}
The code above will make Leddigits0 change its state from 0 to 99.
Thanks for the info...Do you think the Arduino side is OK?
The reason I ask is everywhere I turn all example code seems very involved but this simple code seems to do what its supposed to?
Cheers
Yes.. been playing around today
Basically I receive 25.0 CR LF
as 50 53 46 48 10 13 so I have tried
if (num >=48 && num <=57){
num=num-48 //to only give me numbers and from 0 to 9
and then send to the LED DIGITS but I only get them one at a time i.e. 2 then 5 etc.
Do you know how to combine the 3 numbers so I just print that number?
That genieWriteObject function only writes one integer state to the leddigits a time. My guess is you will have to figure out which states display the digits 0 to 9. Then you can take the
50 53 46
and subtract '0' from them. Yes, it is legal to calculate the difference between int and char. So 50 - '0' would give the result of 2. Then using the correct state you discovered earlier for the digit 2, you would print the number. And changing the 0x00 would write to different leddigits. So instead of writing to leddigits0 (0x00) try writing also to leddigits1 (0x01).
atually that sounds like an good idea
so I could set up 3 led digits (1,2,3) send 2 to the first 5 to the second print a '.' and the final int to 3
I'll let you know how I get on tomorrow
Cheers