Move sonar init function to main
This commit is contained in:
parent
98e9ccf3dd
commit
60aedbc945
@ -13,7 +13,7 @@
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
#ifndef F_CPU
|
#ifndef F_CPU
|
||||||
#define F_CPU 1000000UL
|
#define F_CPU 1000000UL // Stock atmega328p
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -37,6 +37,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
init_leds();
|
init_leds();
|
||||||
init_servos();
|
init_servos();
|
||||||
|
init_sonar();
|
||||||
|
|
||||||
run_servos();
|
run_servos();
|
||||||
read_temp();
|
read_temp();
|
||||||
|
@ -31,7 +31,6 @@ ISR(TIMER1_OVF_vect)
|
|||||||
int32_t read_sonar(void)
|
int32_t read_sonar(void)
|
||||||
{
|
{
|
||||||
int dist_in_cm = 0;
|
int dist_in_cm = 0;
|
||||||
init_sonar();
|
|
||||||
trigger_sonar();
|
trigger_sonar();
|
||||||
|
|
||||||
// While echo pin is low
|
// While echo pin is low
|
||||||
|
Loading…
Reference in New Issue
Block a user