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.
Dependencies: mbed
Fork of AnalogIn_HelloWorld_WIZwiki-W7500 by
Revision 8:bc6291805741, committed 2016-02-03
- Comitter:
- IOP
- Date:
- Wed Feb 03 07:27:16 2016 +0000
- Parent:
- 7:6b50af097b44
- Commit message:
- put some comments
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6b50af097b44 -r bc6291805741 main.cpp
--- a/main.cpp Wed Jan 06 07:27:52 2016 +0000
+++ b/main.cpp Wed Feb 03 07:27:16 2016 +0000
@@ -2,9 +2,10 @@
#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
+DigitalOut myled_R(LED_RED);
+
+AnalogIn ain(A0);
+
int main(void)
{
@@ -14,15 +15,21 @@
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
+ // Compare between 'Specific value' and 'Analog Input 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);
+ printf("voltage value : %3.3f\r\n", ain.read()*3.3f); // voltage 0.0V ~ 3.3V
+ printf("analog value : %3.3f\r\n", ain.read()); // analog value 0.0 ~ 1.0
+ printf("analog value x1000 : %d\r\n",ain_val); // analog value 0 ~ 1000
wait(1.0);
}
}
diff -r 6b50af097b44 -r bc6291805741 mbed.bld --- a/mbed.bld Wed Jan 06 07:27:52 2016 +0000 +++ b/mbed.bld Wed Feb 03 07:27:16 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96 \ No newline at end of file
