Test of ADC Pin to battery level on Coragem device
main.cpp
- Committer:
- szqt
- Date:
- 2017-02-06
- Revision:
- 0:54f4263790ee
- Child:
- 2:26e1d1bf3d08
- Child:
- 3:50c27e4261e2
File content as of revision 0:54f4263790ee:
#include "mbed.h" //DigitalOut led1(LED1); DigitalOut led1(P0_13); DigitalOut led2(P0_14); DigitalOut led3(P0_15); DigitalOut led4(P0_16); InterruptIn button1(P0_11);//(USER_BUTTON); InterruptIn button2(P0_12); InterruptIn button3(P0_24); InterruptIn button4(P0_25); void button1_pressed() { led1 = led2 =led3 =led4 = 1; led1 = 0; } void button1_released() { led1 = led2 =led3 =led4 = 1; //led1 = 0; } void button2_pressed() { led1 = led2 =led3 =led4 = 1; led2 = 0; } void button2_released() { led1 = led2 =led3 =led4 = 1; //led1 = 0; } void button3_pressed() { led1 = led2 =led3 =led4 = 1; led3 = 0; // wait(0.1); } void button3_released() { led1 = led2 =led3 =led4 = 1; //led1 = 0; } void button4_pressed() { led1 = led2 =led3 =led4 = 1; led4 = 0; } void button4_released() { led1 = led2 =led3 =led4 = 1; //led1 = 0; } // main() runs in its own thread in the OS // (note the calls to Thread::wait below for delays) int main() { led1 = led2 =led3 =led4 = 0; button1.fall(&button1_pressed); button1.rise(&button1_released); button2.fall(&button2_pressed); button2.rise(&button2_released); button3.fall(&button3_pressed); button3.rise(&button3_released); button4.fall(&button4_pressed); button4.rise(&button4_released); while (true) { // led1 = !led1; // wait(0.5); // led2 = !led2; // wait(0.5); // led3 = !led3; // wait(0.5); // led4 = !led4; // wait(0.5); } }