Help needed

I am using this here to control a relay and works fine:
ear.addCommand("ventilator off", arduino.getName(), "digitalWrite", 12, 0)

I would like to use it as a definition, e.g. like:

def ventilatoroff():
    sleep(1)
    digitalWrite,12,0
    mouth.speakBlocking("ok, ventilator off")

Does anyone know how to do this the correct way? Thanks.

bensonofjohn's picture

Would it not be something

Would it not be something like

 

arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM15")
 
...
 
ear.addCommand("ventilator off", "python", "ventilatoroff")
 
...
 
def ventilatoroff():
    sleep(1)
    arduino.digitalWrite(12,0)
    mouth.speakBlocking("ok, ventilator off")
Mastablasta's picture

Thanks

Thanks a lot, I owe you a beer!

 

GroG's picture

Beer Cred !!!

Nice !