2

I want to control the mBed controller with python 2.7 I tried this code as start

from mbedrpc import *

serdev = '/dev/tty.usbmodemfa122'

mbed = SerialRPC("/dev/tty.usbmodemfa122", 9600)

x = DigitalOut(mbed, "LED1")

x.write(1)

It always shows me this error

File "/Users/Desktop/testRPC/mbedrpc.py", line 78, in __init__
   self.ser.setBaudrate(baud)
AttributeError: 'Serial' object has no attribute 'setBaudrate'

Could someone help me please ?

A.BM
  • 33
  • 1
  • 3
  • 1
    Possible duplicate of [DroneKit: Failed to connect to /dev/tty.usbmodem1411 : 'Serial' object has no attribute 'setBaudrate'](http://stackoverflow.com/questions/34602168/dronekit-failed-to-connect-to-dev-tty-usbmodem1411-serial-object-has-no-at) – SiHa Feb 13 '17 at 08:41
  • Indeed looks like a duplicate. Can you verify whether switching to pySerial 2.x via `pip install "pySerial>=2.0,<=2.9999` works? – Jan Jongboom Feb 13 '17 at 09:43
  • Thank you that's helped me. Now I don't have any error but the code doesn't work means the led isn't activated. Have you any suggestion ?? – A.BM Feb 16 '17 at 08:18
  • Please put it in a new question. – Jan Jongboom Feb 17 '17 at 11:12
  • ok thank you very much – A.BM Feb 20 '17 at 02:41

0 Answers0