How i can pilot a microcontroller with serial linu

Monkey Forums/Monkey Beginners/How i can pilot a microcontroller with serial linu

FaSaSoftware(Posted 2014) [#1]
How i can pilot a microcontroller with serial port trhought linux??....in other words...i would like to pilot on my microcomputer olinuxlino a13 linux, a microcontroller via serial port....it is possible...how i can,...can you give me some examples please????


thanks a lot in advance...

best regards,

Lestroso

www.fasasoftware.com


Nobuyuki(Posted 2014) [#2]
There is no serial port direct access in Monkey. However you probably can communicate with the serial port using a port redirector like REMSerial and then using brl.socket to communicate with localhost. If you can already route your serial io to standard streams (stdio), then you could also use netcat to route it to a local port and then communicate that way.

Alternatively, you can code native versions of serial port communication and use Externs to access them. They will be target-specific.


FaSaSoftware(Posted 2014) [#3]
Dear Nobuyuki,

i'm not be able to make a driver by my own....i'm a beginner....first of all i need to test monkey-x if work with debian linux...image...this is the first step...then i must find someone could help me as soon as possible...to work with serial port under linux...

can someone help me??? please???

Best regards,

Lestroso,
www.fasasoftware.com


AdamRedwoods(Posted 2014) [#4]
you can try to send a command line to minicom or screen using
Import os
Execute("screen /dev/ttyS0")

but you won't be able to pipe it back as a string. although you COULD pipe it into another file and then read that file. the file is a string so you can parse the string.
Execute("setserial -g /dev/ttyS* > devices.txt")
Local file$ = LoadString("devices.txt")
Print file

the only problem is I don't know how to get around the sudo prompts if they come up.

the final resort would be to wrap libserial and use that. but that is beyond this scope.


Nobuyuki(Posted 2014) [#5]
the only problem is I don't know how to get around the sudo prompts if they come up.


running sudo with -S lets you send the password to /dev/stdin, maybe you could run another process to direct the password there