开机后的闪灯程序是这样的了……。
#include "mbed.h"
DigitalOut myled(LED);//也可以为PA_5,DigitalOut myled(PA_5);这个是接LED灯的管脚!想改那只脚就改吧!
int main()
{
while(1)
{
myled = 1; // LED is ON
wait(0.2); // 200 ms
myled = 0; // LED is OFF
wait(1.0); // 1 sec
}
}
定时器程序是这个样子的了!
// Blink until timeout.
#include "mbed.h"
Timeout timeout;
DigitalOut led(LED1);
int on = 1;
void attimeout()
{
on = 0;
}
int main()
{
timeout.attach(&attimeout, 5);
while(on)
{
led = !led;