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 4:46410fc301ea, committed 2015-07-06
- Comitter:
- justinkim
- Date:
- Mon Jul 06 01:30:22 2015 +0000
- Parent:
- 3:abab0082e271
- Child:
- 5:2b825fae647d
- Commit message:
- Temp36 HelloWorld Example for WIZwiki-W7500
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed-src.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jul 02 07:34:56 2015 +0000
+++ b/main.cpp Mon Jul 06 01:30:22 2015 +0000
@@ -1,26 +1,23 @@
-/* Analog Input Example Program */
+/* Analog Input "Temp36" Temperature Sensor Example Program */
#include "mbed.h"
-// Initialize a pins to perform analog input and digital output fucntions
-AnalogIn ain(A0);
-DigitalOut myled(LED1); // on-board LED_RED
+// Initialize a pins to perform analog input fucntions
+AnalogIn ain(A0); // connect A0(WIZwiki-W7500) to Vout(Temp36)
int main(void)
{
- while (1) {
- // test the voltage on the initialized analog pin
- // and if greater than 0.4 * VCC set the digital pin
- // to a logic 1 otherwise a logic 0
- if(ain > 0.4f) {
- myled = 1; // Red LED Off
- } else {
- myled = 0; // Red LED On
- }
+ while (1)
+ {
+ float V = ain.read() * 3.3; // connect Vs(Temp36) to 3.3V(WIZwiki-W7500)
+ //float V = ain.read() * 5; // connect Vs(Temp36) to 5V(WIZwiki-W7500)
- // print the percentage and normalized values
- printf("percentage: %3.3f%%\r\n", ain.read()*100.0f);
- printf("analog value : %3.3f\r\n", ain.read());
+ float tempC = (V-0.5) * 100; // calculate temperature C
+ float tempF = (tempC * 9 / 5) + 32.0; // calculate temperature F
+
+ printf("tempC value : %5.2f C \r\n", tempC);
+ printf("tempF value : %5.2f F \r\n", tempF);
+
wait(1.0);
}
}
--- a/mbed-src.lib Thu Jul 02 07:34:56 2015 +0000 +++ b/mbed-src.lib Mon Jul 06 01:30:22 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-src/#53297373a894 +http://mbed.org/users/mbed_official/code/mbed-src/#39197bcd20f2


