Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 9 months ago.
jojo
#include "mbed.h"
DigitalIn sw(dp25);
DigitalOut led(dp28);
int num = 0;
int main()
{
sw.mode(PullUp);
while (1)
{
if (sw == false)
{
num = num + 1;
}
if (num == 0)
{
led = true;
wait (1.0);
led = false;
wait(1.0);
}
if (num == 1)
{
led = true;
wait (0.5);
led = false;
wait(0.5);
}
if (num == 2)
{
led = true;
wait (0.2);
led = false;
wait(0.2);
}
if (num == 3)
{
num = 0;
}
}
}