ticker test program 過去にtikcker機能が2個までしか使えなかった。これを確かめるためのテスト。 このプログラムでは18個まで同時実行できることを確かめた。

Dependencies:   mbed testTicker

main.cpp

Committer:
suupen
Date:
2016-11-13
Revision:
1:580e90754d2d
Parent:
0:6c81f3be119c

File content as of revision 1:580e90754d2d:

/** ticker Characteristic test 
 * Test how much you can execute the ticker instruction
 */

#include "mbed.h"
#include "testTicker.h"

DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);

// Test of the ticker function in library

testTicker librarypin5(p5, 100 * 1000);
testTicker libraryLED6(p6, 200 * 1000);
testTicker libraryLED7(p7, 300 * 1000);
testTicker libraryLED8(p8, 400 * 1000);
testTicker libraryLED9(p9, 500 * 1000);
testTicker libraryLED10(p10, 600 * 1000);
testTicker libraryLED11(p11, 700 * 1000);
testTicker libraryLED12(p12, 800 * 1000);
testTicker libraryLED13(p13, 900 * 1000);
testTicker libraryLED14(p14, 1000 * 1000);
testTicker libraryLED15(p15, 1100 * 1000);
testTicker libraryLED16(p16, 1200 * 1000);
testTicker libraryLED17(p17, 1300 * 1000);
testTicker libraryLED18(p18, 1400 * 1000);
testTicker libraryLED19(p19, 1500 * 1000);
testTicker libraryLED20(p20, 1600 * 1000);

testTicker libraryLED4(LED4, 1000 * 1000);


Ticker tickerLed1;
void interruptLed1(void)
{
    led1 = !led1;
    }

Ticker tickerLed2;
void interruptLed2(void)
{
    led2 = !led2;
    }

Ticker tickerLed3;
void interruptLed3(void)
{
    led3 = !led3;
    }



int main() {

    tickerLed1.attach(&interruptLed1, 0.1);
    tickerLed2.attach(&interruptLed2, 0.2);
    tickerLed3.attach(&interruptLed3, 0.3);

    while(1) {
    }
}