I have been trying to allow LiveCode and an Arduino Uno to communicate with each other through serial. I have tried various methods, and yet I cannot get either transmitting or receiving from LiveCode to work.
Receiving data from Arduino in LiveCode
I set up a simple sketch on the Arduino which transmitted a line of text repeatedly every second. Using this thread: http://forums.livecode.com/phpBB2/viewt ... =9&t=22617, I created the following script (placed on a button):
Code: Select all
on MouseUp
open driver "COM4:" for binary update
read from driver "COM4:" for 1 line in 100 milliseconds
put it
close driver "COM4:"
end mouseUp
Sending data from LiveCode in Arduino
I set up a simple sketch on the Arduino that turned on an LED when it received a letter ('a') from the serial port. I tested this using the standard Arduino serial monitor program and it worked successfully. When I tried to send 'a' from LiveCode, the LED did not switch on. However, the RX (receiving serial data light on the Arduino) light flashed to indicate that the Arduino was receiving something, however I am not sure what that something was.
Does anyone know how I can fix these problems? For receiving data, I would ideally like the serial port to appear like a file, where data can be "written" to it bu the Arduino, and only disappears from the file once LiveCode has read it. For sending data, I would just like it to work! (the text that LiveCode sends to Arduino can be received by the Arduino).
Thank you,
Andrew