Alain Pegatoquet
/
_er1_test_vcs
Programme de test pour LPC1768 (affichage de LED avec tempo)
Revision 4:36752a79e890, committed 2017-09-06
- Comitter:
- alainpegatoquet
- Date:
- Wed Sep 06 07:26:53 2017 +0000
- Parent:
- 3:412b0e9270ee
- Parent:
- 2:48ae4b9e8cd8
- Commit message:
- Version 4: merge des 2 versions
Changed in this revision
diff -r 412b0e9270ee -r 36752a79e890 const.h --- a/const.h Wed Sep 06 06:54:18 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -#ifndef CONST_H -#define CONST_H - -#define TEMPO1 0.2 -#define TEMPO2 0.5 - -#endif \ No newline at end of file
diff -r 412b0e9270ee -r 36752a79e890 main.cpp --- a/main.cpp Wed Sep 06 06:54:18 2017 +0000 +++ b/main.cpp Wed Sep 06 07:26:53 2017 +0000 @@ -1,17 +1,19 @@ #include "mbed.h" -#include "const.h" - +Serial pc(USBTX, USBRX); DigitalOut myled(LED1); DigitalOut myled1(LED3); +AnalogIn Ain(p20); // Analog input -int main() -{ +int main() { + float ADCdata; while(1) { + myled = 1; + myled1 = 0; + wait(1.0); + myled = 0; myled1 = 1; - myled2 = 0; - wait(TEMPO1); - myled1 = 0; - myled2 = 1; - wait(TEMPO2); + wait(1.0); + ADCdata=Ain.read(); + pc.printf("%f\t%fV \n\r",ADCdata, ADCdata*3.3); } }
diff -r 412b0e9270ee -r 36752a79e890 main.cpp.orig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp.orig Wed Sep 06 07:26:53 2017 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "const.h" + +DigitalOut myled(LED1); +DigitalOut myled1(LED3); + +int main() +{ + while(1) { + myled1 = 1; + myled2 = 0; + wait(TEMPO1); + myled1 = 0; + myled2 = 1; + wait(TEMPO2); + } +}