Arduino Radar code troubleshooting

Thread Starter

chrisjsmith

Joined Nov 12, 2016
41
Hello all,

I'm trying to build a radar system using the common hc-sr04 ultra sonic sensor which rotates ontop of a stepper motor and shows the distance of objects using a 4 digit 7 segment display while also providing audible alerts at certain distances. I've all individual code for each sub system working individually. My problem is with integrating the code into one program which does everything.

I've been able to integrate the ultrasonic sensor,4 digit seven segment display and the audio alerts to work perfectly. However when i attempt to integrate the motor code, and run all the components together all functionalities i had before is no longer working. Attached is my code, i'm very new to programming arduino. The motor is powered by a separate 5v supply. All other sub components are powered by the arduino board.
This is the section of code in the void loop() which causes everything else not to work. When removed i have back functionality.
"
{
// make the stepper do 1.5 rotations CW
turns(1);
delay(1000);
// make the stepper do 1.5 rotations CCW
turns(-1);
delay(1000);

} "
 

Attachments

MrChips

Joined Oct 2, 2009
34,809
What were your expectations?
Did you expect to see the display show distance readings as the stepping motor rotated?
Then take a small step in one direction, readout the distance, and repeat many times.
If you desire, step in the reverse direction, many small steps at a time.
 

Thread Starter

chrisjsmith

Joined Nov 12, 2016
41
Oh, point noted
i believe i was attempting to do more than one thing at the same time...i'll try it as you suggested
Thanks for this
 
Top