Hi ! (English is not my mother tong, so I'm already sorry)
Short version:
I use an Arduino Mega, with Pyfirmata.
Yesterday I use this function :
def moteur_capteur(moteur, capteur):
board.digital[moteur].write(1)
while True:
if capteur.read() == False:
board.digital[moteur].write(0)
time.sleep(1)
break
So I turn ON the motor, and when the sensor is touch (False), the motor stop.
Yesterday, it worked perfectly, and today … well not any more.
And I totally don't get why !
Thanks for your help.
Edit : I put on the top of the file : #usr /bin/python and it worked only once …
DrAzzy
December 13, 2017, 3:33pm
2
If the code was not changed since it last worked, that suggests it probably isn't a coding issue (though there could totally be some pyfirmata-related complexity I haven't accounted for, as I don't use that), have you doublechecked the hardware connections? Particularly if it's on breadboard, breadboard is highly subject to loose wires.
This looks like you have a floating input in your circuit. Please post your circuit for more specific help.
Hey !
Sorry, for the delay ^^
The "solution": I just create an other file, a copy ^^
And if the problem occur, I switch with this file …
I totally don't get it but well … it works ^^
Thanks folks !
I totally don't get it but well … it works ^^
Sorry no it dosn't. You are fooling yourself. It is much more reliable reading chicken entrails.