Go Down

Topic: From one day to the next, Arduino doesn't work properly  (Read 435 times) previous topic - next topic

mister_why

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 :

Code: [Select]
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

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.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Grumpy_Mike

This looks like you have a floating input in your circuit. Please post your circuit for more specific help.

mister_why

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 !

Grumpy_Mike

Quote
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.

Go Up