Blinky Leds with mbed-src lpc1768

Dependencies:   mbed-src

Committer:
RCMISbed
Date:
Fri Oct 12 15:44:32 2018 +0000
Revision:
0:9a9808721f4b
mbed-src blinky lpc1768

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RCMISbed 0:9a9808721f4b 1 #include "mbed.h"
RCMISbed 0:9a9808721f4b 2
RCMISbed 0:9a9808721f4b 3 #define TSample 0.001
RCMISbed 0:9a9808721f4b 4 #define Periode 900
RCMISbed 0:9a9808721f4b 5 #define onTime 10
RCMISbed 0:9a9808721f4b 6
RCMISbed 0:9a9808721f4b 7 DigitalOut led(LED1);
RCMISbed 0:9a9808721f4b 8 DigitalOut son(p8);
RCMISbed 0:9a9808721f4b 9 //DigitalOut son(PA_1);
RCMISbed 0:9a9808721f4b 10
RCMISbed 0:9a9808721f4b 11 int wdt = 0;
RCMISbed 0:9a9808721f4b 12 char msg[] = "Salut artiste";
RCMISbed 0:9a9808721f4b 13 Ticker TMainProcess;
RCMISbed 0:9a9808721f4b 14
RCMISbed 0:9a9808721f4b 15 void MainProcess_Isr(void){
RCMISbed 0:9a9808721f4b 16 --wdt;
RCMISbed 0:9a9808721f4b 17 if((wdt< onTime)& (wdt> 0)){led= 1;};
RCMISbed 0:9a9808721f4b 18 if(wdt<= 0){led= 0; wdt= Periode;};
RCMISbed 0:9a9808721f4b 19 }
RCMISbed 0:9a9808721f4b 20
RCMISbed 0:9a9808721f4b 21 void init(void){
RCMISbed 0:9a9808721f4b 22 // son= 1;
RCMISbed 0:9a9808721f4b 23 TMainProcess.attach(&MainProcess_Isr, TSample);
RCMISbed 0:9a9808721f4b 24 son= 0;
RCMISbed 0:9a9808721f4b 25 }
RCMISbed 0:9a9808721f4b 26
RCMISbed 0:9a9808721f4b 27
RCMISbed 0:9a9808721f4b 28 // main() runs in its own thread in the OS
RCMISbed 0:9a9808721f4b 29 int main(void) {
RCMISbed 0:9a9808721f4b 30 led= 0;
RCMISbed 0:9a9808721f4b 31 TMainProcess.attach(&MainProcess_Isr, TSample);
RCMISbed 0:9a9808721f4b 32 while (true) {};
RCMISbed 0:9a9808721f4b 33 return 3;
RCMISbed 0:9a9808721f4b 34 }
RCMISbed 0:9a9808721f4b 35