Serial struggle
Posted: Fri Dec 19, 2008 2:19 am
Hi Folks,
I'm still struggling away with my RunRev Arduino Microcontroller interface. Probably way over my head but too excited by the possibilities to give up. I've been struggling all day with something which doesn't make any sense to me. The microcontroller is set to send lines of data (Serial.Println()) to the serial port. The data reports on a potentiometer and reads from 0 to 1024.
I have the following code in RunRev to read the incomming numbers:
The problem is that when the potentiometer/microcontroller reads 1000 to 1010 I get a reading of 100 and if I leave it on this reading too long it gets stuck and I have to reset the port. I also get frequent errors on starting read from the port because of non numbers. However if my script checks if the data is a number I don't get any readings at all!
Does any of this make sense because I'm at a complete loss:?
Any thoughts or advice much appreciated.
Jim H
I'm still struggling away with my RunRev Arduino Microcontroller interface. Probably way over my head but too excited by the possibilities to give up. I've been struggling all day with something which doesn't make any sense to me. The microcontroller is set to send lines of data (Serial.Println()) to the serial port. The data reports on a potentiometer and reads from 0 to 1024.
I have the following code in RunRev to read the incomming numbers:
Code: Select all
on readPort
set the numberformat to "0000"
if the hilite of btn "Port open" = true then
put the label of btn "Port" into thePort
read from driver thePort until 100
if it is not empty then put it into recVar --and it is a number
put the number of lines in recVar into fld "recLines"
repeat with x=1 to the number of lines in recVar
put item 1 of line x of recVar & "," before line 1 of tList
put max (tList) into fld "AinFld0"
end repeat
send readPort to me in 50 milliseconds
end if
end readPort
Does any of this make sense because I'm at a complete loss:?
Any thoughts or advice much appreciated.
Jim H