Problem with "square_wave"
Paul O
Posts: 3
Hi, new to this forum. Using the QuickStart board, SimpleIDE.
Want to flash two LEDs to simulate a RR crossbuck flasher.
I'm using "square_wave" from 'simple_tools'h'.
The first time I call "square_wave / delay / square_wave it works properly.
Then I call "square_wave_stop" -- stops both LEDs.
The next call to square_wave causes both LEDs to blink in sync.
Sample code is below; any suggestions?
Thanks, Paul O
/*
Flash two crossbuck lamps at a 1 Hz. rate.
*/
#include "simpletools.h" // Include simple tools
int main() // Main function
{
while(1)
{
square_wave(10, 0, 1); // 1 Hz. flash rate - first LED
pause (500); // Delay 1/2 second
square_wave(11, 1, 1); // 1 Hz. flash rate - second LED
pause(6000);
square_wave_stop(); // Stop both LEDs
pause(4000); // Delay for 4 seconds
} // Do it again
}
Want to flash two LEDs to simulate a RR crossbuck flasher.
I'm using "square_wave" from 'simple_tools'h'.
The first time I call "square_wave / delay / square_wave it works properly.
Then I call "square_wave_stop" -- stops both LEDs.
The next call to square_wave causes both LEDs to blink in sync.
Sample code is below; any suggestions?
Thanks, Paul O
/*
Flash two crossbuck lamps at a 1 Hz. rate.
*/
#include "simpletools.h" // Include simple tools
int main() // Main function
{
while(1)
{
square_wave(10, 0, 1); // 1 Hz. flash rate - first LED
pause (500); // Delay 1/2 second
square_wave(11, 1, 1); // 1 Hz. flash rate - second LED
pause(6000);
square_wave_stop(); // Stop both LEDs
pause(4000); // Delay for 4 seconds
} // Do it again
}
Comments
The full C code program checks sensors for a train, flashes the lights, lowers the gates, waits for the end of train,
raises the gates, stops the lights then goes back to the beginning to wait for the next train.
I have the same problem as the test code I posted when the second train comes by.
Paul O
Andy
I've also noticed that it only fails if the frequency is the same value in both calls to the routine.
Paul O