mbed-os/libraries/tests/mbed/time_us/main.cpp

50 lines
832 B
C++
Raw Normal View History

#include "mbed.h"
#ifdef TARGET_KL25Z
2013-04-11 16:13:23 +00:00
DigitalOut out(PTD4);
2014-03-08 21:26:09 +00:00
#elif defined(TARGET_KL05Z)
DigitalOut out(PTB1);
2014-03-08 21:26:09 +00:00
#elif defined(TARGET_KL46Z)
DigitalOut out(PTA1);
2014-04-03 19:30:01 +00:00
#elif defined(TARGET_K64F)
DigitalOut out(PTA1);
2014-03-08 21:26:09 +00:00
#elif defined(TARGET_LPC812)
DigitalOut out(D10);
#elif defined(TARGET_NUCLEO_F103RB) || \
defined(TARGET_NUCLEO_L152RE) || \
defined(TARGET_NUCLEO_F302R8) || \
defined(TARGET_NUCLEO_F030R8) || \
defined(TARGET_NUCLEO_F401RE)
DigitalOut out(LED1);
#else
DigitalOut out(p5);
#endif
2013-04-11 16:13:23 +00:00
DigitalOut led(LED1);
#define MS_INTERVALS 1000
void print_char(char c = '*')
{
printf("%c", c);
fflush(stdout);
}
int main()
{
while (true) {
for (int i = 0; i < MS_INTERVALS; i++) {
wait_us(1000);
out = !out;
}
2013-04-11 16:13:23 +00:00
led = !led;
print_char();
}
}