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:
- 2016-01-06
- Revision:
- 7:6b50af097b44
- Parent:
- 6:885e2cb16d7d
- Child:
- 8:bc6291805741
File content as of revision 7:6b50af097b44:
/* 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) { int ain_val = 0; while (1) { ain_val = ain.read()*1000; // compare with specific value if(ain_val > 500) myled_R = 1; // Red LED OFF else myled_R = 0; // Red LED ON // 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()); printf("analog value x1000 : %d\r\n",ain_val); wait(1.0); } }