0
$\begingroup$

Rosanswers logo

#!/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):
        
        
        self.__sendNow(P,0,0,0)
        sleep(1)
        self.__sendNow(V,0,0,100)
        sleep(10)


    def stop(self):
        
        self.__sendNow(V,0,0,0) 

/home/admin-pc/mywork/test/scripts/create.py: 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/create.py: line 6: class: command not found
/home/admin-pc/mywork/test/scripts/create.py: line 7: Wrapper class for the iRobot Create: command not found
/home/admin-pc/mywork/test/scripts/create.py: line 9: syntax error near unexpected token ('/home/admin-pc/mywork/test/scripts/create.py: line 9: def init(self, tty="/dev/ttyUSB0"):'


Originally posted by lifelonglearner on ROS Answers with karma: 205 on 2013-08-04

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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)
ser.write('5')

Originally posted by lifelonglearner with karma: 205 on 2013-08-05

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.