A simple program to Toggle the 2 OnBoard LEDs.

Fork of Blinky_Led2 by Rohan Gurav

Committer:
RGurav
Date:
Sun Jul 22 19:50:46 2018 +0000
Revision:
1:c8bf330e87ba
Parent:
0:889636b54b07
Simple LED blinking program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RGurav 1:c8bf330e87ba 1 /*
RGurav 1:c8bf330e87ba 2 Created on: 12/05/2018
RGurav 1:c8bf330e87ba 3 Source: (Self)
RGurav 1:c8bf330e87ba 4 Code: This code toggles the status of the onboard leds with a count-down
RGurav 1:c8bf330e87ba 5 */
RGurav 1:c8bf330e87ba 6
RGurav 0:889636b54b07 7 #include "mbed.h"
RGurav 0:889636b54b07 8
RGurav 1:c8bf330e87ba 9 DigitalOut led2(P2_10);
RGurav 0:889636b54b07 10 DigitalOut led1(LED1);
RGurav 1:c8bf330e87ba 11 Serial pc(USBTX, USBRX);
RGurav 1:c8bf330e87ba 12 int16_t i = 3;
RGurav 0:889636b54b07 13
RGurav 0:889636b54b07 14 // main() runs in its own thread in the OS
RGurav 1:c8bf330e87ba 15 int main()
RGurav 0:889636b54b07 16 {
RGurav 0:889636b54b07 17 led1 = 1;
RGurav 0:889636b54b07 18 led2 = 0;
RGurav 1:c8bf330e87ba 19
RGurav 1:c8bf330e87ba 20 while (true) {
RGurav 0:889636b54b07 21 led2 = !led2;
RGurav 0:889636b54b07 22 led1 = !led1;
RGurav 0:889636b54b07 23 wait(0.5);
RGurav 1:c8bf330e87ba 24 pc.printf("Toggle in : \r\n");
RGurav 1:c8bf330e87ba 25 for (i = 1; i <= 3; i++)
RGurav 1:c8bf330e87ba 26 {
RGurav 1:c8bf330e87ba 27 pc.printf("%d\n",(i));
RGurav 1:c8bf330e87ba 28 }
RGurav 0:889636b54b07 29 }
RGurav 0:889636b54b07 30 }
RGurav 0:889636b54b07 31