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-08-04
- Revision:
- 6:885e2cb16d7d
- Parent:
- 5:97fa889845b0
- Child:
- 7:6b50af097b44
File content as of revision 6:885e2cb16d7d:
/* Analog Input Example Program */ #include "mbed.h" // Initialize a pins to perform analog input and digital output fucntions AnalogIn ain(A0); DigitalOut myled_R(LED_RED); // LED_RED on WIZwiki-W7500 int main(void) { while (1) { // If greater than 0.5 * 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("======================\r\n"); printf("voltage value : %3.3f\r\n", ain.read()*3.3f); printf("analog value : %3.3f\r\n", ain.read()); wait(1.0); } }