Ping and Stepper – Problems

After I managed to get the stepper motor to work, I combined the two sets of codes from the Ping Sensor and the stepper motor, so I would be a step closer to a working final outcome. However, I encountered a problem when I combined them and ran the sketch – the motor would run much slower and more jittery than when it was run separately, and the Ping sensor was also very slow and would only flash once every second, meaning the input data it was receiving was very varied and unreliable.

I tried to overcome the problem by adding an extra power source of a 9V battery to the circuit but the problem still persisted, so from this I concluded it must be something to do with the code rather than power/circuit.

In my code ‘myStepper.step(STEPS);’ seemed to what was causing the problem as it was going through the loop and and not going to the next element before completing this that step, so my next task is to replace that line of code with an input code from the sensor. This input from the sensor will trigger the motor to run, ie when someone engages with the installation from 2.5 meters away, the motor will start to turn slowly. If they come closer it will turn faster with a threshold of 80 for example. (See my previous post about speed of steps.) So next challenge = sensor input code to trigger motor.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s