Shinichiro Nakamura
/
TestProgramForBugTopic990
This is a test program for http://mbed.org/forum/bugs-suggestions/topic/990/
main.cpp
- Committer:
- shintamainjp
- Date:
- 2010-08-16
- Revision:
- 0:3eb38701225c
- Child:
- 1:4cfa24bbc098
File content as of revision 0:3eb38701225c:
/** * Test program for a bug. (http://mbed.org/forum/bugs-suggestions/topic/990/) * * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) * http://shinta.main.jp/ */ #include "mbed.h" BusOut myled(LED4, LED3, LED2, LED1); Ticker tickerForLED; Ticker tickerForAnother; /** * Tick function for toggle 4 LEDs. */ void tickfunc_led(void) { myled = myled + 1; } /** * Tick function for another ticker. */ void tickfunc_another(void) { // Do nothing. } int main() { int n = 0; /* * Start my LED ticker. */ tickerForLED.attach(&tickfunc_led, 0.2); /* * Wait 5 seconds. */ wait(5); /* * Attach another ticker. * Then the LED ticker will be stop. */ while (1) { /* * Check for this loop. */ printf("n=%d\n", n++); /* * Change my another ticker. */ tickerForAnother.attach_us(&tickfunc_another, 2 * 1000); wait_ms(100); tickerForAnother.attach_us(&tickfunc_another, 2 * 1000); wait_ms(100); tickerForAnother.attach_us(&tickfunc_another, 2 * 1000); wait_ms(100); } }