News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
io.open /dev/ttyS0
Author Message
chrimo
Member
***


Posts: 94
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
RE: io.open /dev/ttyS0

chrimo Wrote:
Hi,

has anybody ever used murgaLua to communicate with a serial device ?
I'd like to write a userfriendly GUI for settings some modem switches.

Code fraqment:

Code:
port="/dev/ttyS0";
in=io.open(port,"r");
out=io.open(port,"w");

while(true) do
result=in:read("*line");
if(string.find(result,"RING")) then
out:write("ATA\n");
end
end



This is just a simple stupid stuff, but later useful for robotic applications
Any idea ?
Thanks
Bye
Christian



Hi all,

this code works very well with my Navilock-GPS Bluetooth receiver at OSX Big Grin
Now starting to code a simple GPS-Tracker-Application.

Bye
Christian

Code:
port="/dev/tty.BT-348_GPS-Serialport-1"

        ttyin = assert(io.open(port, "r"))
        ttyin:flush()
        while (1) do
           ttyin:flush()
           reply = ttyin:read("*line")
                print("Reply:"..reply);
        end

        ttyin:close()


Output from GPS:
Reply:$GPGSA,A,3,25,29,10,24,27,08,28,,,,,,2.2,1.2,1.8*34
Reply:$GPRMC,101733.000,A,5322.8875,N,00936.3823,E,0.07,191.51,290707,,,A*6A
Reply:$GPVTG,191.51,T,,M,0.07,N,0.1,K,A*06
Reply:$GPGGA,101734.000,5322.8874,N,00936.3823,E,1,07,1.2,48.1,M,46.1,M,,0000*65
Reply:$GPGSA,A,3,25,29,10,24,27,08,28,,,,,,2.2,1.2,1.8*34
Reply:$GPRMC,101734.000,A,5322.8874,N,00936.3823,E,0.19,250.10,290707,,,A*68
Reply:$GPVTG,250.10,T,,M,0.19,N,0.3,K,A*00
Reply:$GPGGA,101735.000,5322.8873,N,00936.3820,E,1,07,1.2,48.1,M,46.1,M,,0000*60
Reply:$GPGSA,A,3,25,29,10,24,27,08,28,,,,,,2.2,1.2,1.8*34
Reply:$GPRMC,101735.000,A,5322.8873,N,00936.3820,E,0.31,263.31,290707,,,A*64
Reply:$GPVTG,263.31,T,,M,0.31,N,0.6,K,A*0C
Reply:$GPGGA,101736.000,5322.8872,N,00936.3817,E,1,07,1.2,48.0,M,46.1,M,,0000*67
Reply:$GPGSA,A,3,25,29,10,24,27,08,28,,,,,,2.2,1.2,1.8*34
Reply:$GPRMC,101736.000,A,5322.8872,N,00936.3817,E,0.19,230.50,290707,,,A*69
Reply:$GPVTG,230.50,T,,M,0.19,N,0.3,K,A*02
Reply:$GPGGA,101737.000,5322.8871,N,00936.3816,E,1,07,1.2,47.9,M,46.1,M,,0000*62
Reply:$GPGSA,A,3,25,29,10,24,27,08,28,,,,,,2.2,1.2,1.8*34
Reply:$GPGSV,3,1,12,08,80,123,35,10,65,240,24,27,56,067,31,29,38,285,28*7C

07-29-2007 09:18 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
io.open /dev/ttyS0 - chrimo - 07-18-2007, 07:45 AM
RE: io.open /dev/ttyS0 - chrimo - 07-29-2007 09:18 PM
RE: io.open /dev/ttyS0 - chrimo - 07-30-2007, 05:51 AM
RE: io.open /dev/ttyS0 - JohnMurga - 07-30-2007, 05:25 PM
RE: io.open /dev/ttyS0 - chrimo - 07-30-2007, 06:13 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: