Project

Hi I am currently building a Wheelchair lift for my college project and I am looking for help with my arduino code. I know its a simple enough code but I have never written one before. What I need the code to achieve.

Push button activated, motor starts rotating the lead screw one direction causing the lift to raise up a certain height and stop.

Next the push button gets activated again and the motor rotates the opposite direction causing the lift to lower until it hits the bottom and stop.

If anybody can help me it would be great thanks

Have you got any of the hardware ?

x00091783: I have never written one before.

Welcome. I'd say you need to work through the tutorials here, or there are loads more like at adafruit for example

x00091783: What I need the code to achieve.

Push button activated, motor starts rotating the lead screw one direction

Next the push button gets activated again and the motor rotates the opposite direction

In particular look at the StateChangeDetection example which is to do with seeing if a button has just become pressed.

I suspect there will be some high power electronics involved here, the lift is likely to be at mains AC maybe?, or if not probably some high current DC. You may need specialist help there unless that's what you're studying.

You will also need to address the safety aspects of this project - how to make sure the user is completely on or off before letting it operate. Making sure it stops at the correct location and perhaps an electronic lock on the safety gate that will not open unless the lift is at the correct location (and the gate has to be closed before the lift will operate. You may need to consider how to get it to move if the last user left the safety gate open. If you don't at least address these issues, you have not done a complete analysis of the project (which is what I would expect if I was grading a project like this for a college course).

One way of organizing the code is to use a state machine. There are no explanations on the net that I'm really happy with but the best one I know comes from one of the long time posters here. See http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html