tino / pyFirmata

Python interface for the Firmata (http://firmata.org/) protocol. It is compliant with Firmata 2.1. Any help with updating to 2.2 is welcome. The Capability Query is implemented, but the Pin State Query feature not yet.
MIT License
575 stars 193 forks source link

problem in running a RGB Led with pyfirmata #111

Closed msarvi closed 11 months ago

msarvi commented 2 years ago

I decided to run RGB led with python Pyfirmata, I read documents, and use the following script:

import pyfirmata
import time
arduino =pyfirmata.Arduino('/dev/cu.usbmodem1411', baudrate=9600)

arduino.digital[9].mode = pyfirmata.OUTPUT
arduino.digital[10].mode = pyfirmata.OUTPUT
arduino.digital[11].mode = pyfirmata.OUTPUT
while True:
    arduino.digital[9].write(0.56)
    arduino.digital[10].write(0.76)
    arduino.digital[11].write(0.67)
    time.sleep(5)

arduino.exit()

no error or exceptions occurred, but the led is not turned on. even I changed the pin modes to PWM.