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);
} "
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
-
8.5 KB Views: 5