dhgdh
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
main.cpp
00001 #include "mbed.h" 00002 #include "test_env.h" 00003 00004 Ticker tick; 00005 DigitalOut led(LED1); 00006 00007 namespace { 00008 const int MS_INTERVALS = 1000; 00009 } 00010 00011 void print_char(char c = '*') 00012 { 00013 printf("%c", c); 00014 fflush(stdout); 00015 } 00016 00017 void togglePin(void) 00018 { 00019 static int ticker_count = 0; 00020 if (ticker_count >= MS_INTERVALS) { 00021 print_char(); 00022 ticker_count = 0; 00023 led = !led; // Blink 00024 } 00025 ticker_count++; 00026 } 00027 00028 int main() 00029 { 00030 MBED_HOSTTEST_TIMEOUT(15); 00031 MBED_HOSTTEST_SELECT(wait_us_auto); 00032 MBED_HOSTTEST_DESCRIPTION(Ticker Int us); 00033 MBED_HOSTTEST_START("MBED_23"); 00034 00035 tick.attach_us(togglePin, 1000); 00036 00037 while (1); 00038 }
Generated on Tue Jul 12 2022 11:01:54 by
1.7.2
