ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Please correct this python script to send data on USB0 port?

asked 2013-08-04 20:08:25 -0600

lifelonglearner gravatar image

updated 2013-08-05 01:19:18 -0600

#!/usr/bin/env python

from serial import Serial
from time import sleep

class Create:

    def __init__(self, tty="/dev/ttyUSB0"):

        self.timeout = 5
        self.port = Serial(tty, 57600, timeout= self.timeout)

    def start(self):


    def stop(self):


/home/admin-pc/mywork/test/scripts/ line 1: This module provides a class wrapping an Exia.: command not found
from: can't read /var/mail/serial
from: can't read /var/mail/time
/home/admin-pc/mywork/test/scripts/ line 6: class: command not found
/home/admin-pc/mywork/test/scripts/ line 7: Wrapper class for the iRobot Create: command not found
/home/admin-pc/mywork/test/scripts/ line 9: syntax error near unexpected token ('/home/admin-pc/mywork/test/scripts/ line 9: def __init__(self, tty="/dev/ttyUSB0"):'

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-05 21:07:09 -0600

lifelonglearner gravatar image

updated 2013-08-05 21:07:55 -0600

Thank you viewers, I found the mistake and corrected it ....

this is just deceleration of class there is no command to write data on USB port.

there is just two line code to do the same

ser = serial.Serial('/dev/ttyS1', 19200, timeout=1)
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-08-04 20:08:25 -0600

Seen: 963 times

Last updated: Aug 05 '13