Testing stuff

Dependencies:   mbed

Committer:
gvela024
Date:
Fri Jun 15 20:25:09 2018 +0000
Revision:
0:f95a24befabd
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gvela024 0:f95a24befabd 1 #include "mbed.h"
gvela024 0:f95a24befabd 2
gvela024 0:f95a24befabd 3 DigitalOut myled(LED1);
gvela024 0:f95a24befabd 4 DigitalOut led2(LED2);
gvela024 0:f95a24befabd 5 DigitalOut led3(LED3);
gvela024 0:f95a24befabd 6
gvela024 0:f95a24befabd 7 AnalogIn adc(P0_26);
gvela024 0:f95a24befabd 8 Serial serial(P0_0, P0_1, 19200);
gvela024 0:f95a24befabd 9
gvela024 0:f95a24befabd 10 int main() {
gvela024 0:f95a24befabd 11
gvela024 0:f95a24befabd 12
gvela024 0:f95a24befabd 13 while(1) {
gvela024 0:f95a24befabd 14 myled = 1;
gvela024 0:f95a24befabd 15 wait(0.2);
gvela024 0:f95a24befabd 16 myled = 0;
gvela024 0:f95a24befabd 17 wait(0.2);
gvela024 0:f95a24befabd 18
gvela024 0:f95a24befabd 19 serial.printf("%5d\n\r", adc.read_u16());
gvela024 0:f95a24befabd 20 if(adc.read_u16() > (0xFFFF / 2))
gvela024 0:f95a24befabd 21 {
gvela024 0:f95a24befabd 22 led2 = 1;
gvela024 0:f95a24befabd 23 led3 = 0;
gvela024 0:f95a24befabd 24 }
gvela024 0:f95a24befabd 25 else
gvela024 0:f95a24befabd 26 {
gvela024 0:f95a24befabd 27 led2 = 0;
gvela024 0:f95a24befabd 28 led3 = 1;
gvela024 0:f95a24befabd 29 }
gvela024 0:f95a24befabd 30 }
gvela024 0:f95a24befabd 31 }