Great Project please help

Here is a schematic of a great project I saw on the net years ago. Arduino Nano moves the motor when you wave your hand in front of IR reflection sensor. motor moves to the right until limit switch and stops. wave your hand again, motor will move opposite direction until it reaches limit switch on the left side and stops. then it remains stopped waiting for you to wave hand.
The nice thing is using the same input pin connection for both limit switches at left or right.
I need help finding the code for it since not enough knowledge to write long code. All I can find on my hard disk is this sketch. This project can have vast applications. can someone help find the website where this code was posted. I trust I can make the detailed schematic if needed. ..

It could take longer to find that code than it would take to write it from scratch!

If it even exists...

You are better off writing your own code - you learn a lot more.

Long code is just lots of short bits put together

1 Like

From what @Goldenshuttle has described so far, it will only be a few lines of code. If it starts to get longer than that, please ask for advice. Beginners often need help finding ways to keep code short. There is always a way to do that.

Hello Goldenshuttle
Take this pseudocode as kickoff for your own coding.

if ((motor()==OFF)&&(irDetect==true) than {reverseMotor(), startMotor();}
if (!limitSwitch1||!limitSwitch2) than stoppMotor(); 

Have a nice day and enjoy coding in C++.
Дайте миру шанс!

Ask yourself what what can happen if:
-- The motor reached the end position
-- The power is turned off
-- The power is turned back on again

There is no shortage of input pins so I'd say use two pins to determine what position the motor is at and in what direction to turn without the system destroying itself...

1 Like

For example?

L293d arduino

I will start using this schematic and add the waive sensor

Let us know how it turn out ok?

I'm curious.

I was looking for code to modify it and add the 2 lines of code given by one of colleagues here. But surprisingly i found the code ready on adafruit website. I prefer to assemble the components and run it physical then share a video:)

Most of us also prefer reading to watching videos. Unless it's entertainment. Well, maybe even some do like to read fiction... :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.