karol przespol / Mbed 2 deprecated Nucleo_blink_led

Dependencies:   mbed

Committer:
mindstorm
Date:
Mon Jun 01 20:16:22 2015 +0000
Revision:
0:597324ae35ab
nowa wersja

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mindstorm 0:597324ae35ab 1 // Toggle a LED
mindstorm 0:597324ae35ab 2 #include "mbed.h"
mindstorm 0:597324ae35ab 3
mindstorm 0:597324ae35ab 4 DigitalOut led1(PB_1);
mindstorm 0:597324ae35ab 5 DigitalOut led2(PB_2);
mindstorm 0:597324ae35ab 6 AnalogIn potencjometr(PB_0);
mindstorm 0:597324ae35ab 7 float x ;
mindstorm 0:597324ae35ab 8 int main() {
mindstorm 0:597324ae35ab 9 led2=1;
mindstorm 0:597324ae35ab 10 while(1) {
mindstorm 0:597324ae35ab 11 x=potencjometr.read();
mindstorm 0:597324ae35ab 12 if (x>=0.5)
mindstorm 0:597324ae35ab 13 {
mindstorm 0:597324ae35ab 14 led1 = !led1;
mindstorm 0:597324ae35ab 15 wait(0.05);
mindstorm 0:597324ae35ab 16 }
mindstorm 0:597324ae35ab 17 if (x<0.5)
mindstorm 0:597324ae35ab 18 {
mindstorm 0:597324ae35ab 19 led1 = !led1;
mindstorm 0:597324ae35ab 20 wait(0.3);
mindstorm 0:597324ae35ab 21 }
mindstorm 0:597324ae35ab 22
mindstorm 0:597324ae35ab 23 }
mindstorm 0:597324ae35ab 24 }