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

7 years 3 months ago

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")