Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of AnalogIn_HelloWorld_WIZwiki-W7500 by
main.cpp
- Committer:
- IOP
- Date:
- 2015-07-24
- Revision:
- 5:97fa889845b0
- Parent:
- 3:abab0082e271
- Child:
- 6:885e2cb16d7d
File content as of revision 5:97fa889845b0:
/* Analog Input Example Program */ #include "mbed.h" // Initialize a pins to perform analog input and digital output fucntions DigitalOut shield_led_off(D10); // LED_GREEN on easy module shield AnalogIn ain(A0); DigitalOut myled_R(D9); // LED_RED on easy module shield int main(void) { shield_led_off = 0; // turn off Green LED on shield while (1) { // If greater than 0.4 * VCC set the digital pin // to a logic 1 otherwise a logic 0 if(ain > 0.5f) { myled_R = 1; // Red LED ON } else { myled_R = 0; // Red LED OFF } // output the voltage and analog values printf("voltage value : %3.3f\r\n", ain.read()*3.3f); printf("analog value : %3.3f\r\n", ain.read()); wait(1.0); } }