Temp36 HelloWorld Example for WIZwiki-W7500

Dependencies:   mbed

Fork of AnalogIn_HelloWorld_WIZwiki-W7500 by IOP

Committer:
justinkim
Date:
Fri Jul 10 05:55:24 2015 +0000
Revision:
5:2b825fae647d
Parent:
4:46410fc301ea
Child:
6:0bbd259454d0
mbed-src -> mbed library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
justinkim 4:46410fc301ea 1 /* Analog Input "Temp36" Temperature Sensor Example Program */
sam_grove 0:101a12a915c6 2
sam_grove 0:101a12a915c6 3 #include "mbed.h"
sam_grove 0:101a12a915c6 4
justinkim 4:46410fc301ea 5 // Initialize a pins to perform analog input fucntions
justinkim 5:2b825fae647d 6 AnalogIn ain(A2); // connect A0(WIZwiki-W7500) to Vout(Temp36)
sam_grove 0:101a12a915c6 7
sam_grove 0:101a12a915c6 8 int main(void)
sam_grove 0:101a12a915c6 9 {
justinkim 4:46410fc301ea 10 while (1)
justinkim 4:46410fc301ea 11 {
justinkim 4:46410fc301ea 12 float V = ain.read() * 3.3; // connect Vs(Temp36) to 3.3V(WIZwiki-W7500)
justinkim 4:46410fc301ea 13 //float V = ain.read() * 5; // connect Vs(Temp36) to 5V(WIZwiki-W7500)
sam_grove 0:101a12a915c6 14
justinkim 4:46410fc301ea 15 float tempC = (V-0.5) * 100; // calculate temperature C
justinkim 4:46410fc301ea 16 float tempF = (tempC * 9 / 5) + 32.0; // calculate temperature F
justinkim 4:46410fc301ea 17
justinkim 4:46410fc301ea 18 printf("tempC value : %5.2f C \r\n", tempC);
justinkim 4:46410fc301ea 19 printf("tempF value : %5.2f F \r\n", tempF);
justinkim 4:46410fc301ea 20
joon874 2:5f564266c94f 21 wait(1.0);
sam_grove 0:101a12a915c6 22 }
sam_grove 0:101a12a915c6 23 }
joon874 3:abab0082e271 24
joon874 3:abab0082e271 25
joon874 3:abab0082e271 26
joon874 3:abab0082e271 27
joon874 3:abab0082e271 28
joon874 3:abab0082e271 29
joon874 3:abab0082e271 30
joon874 3:abab0082e271 31
joon874 3:abab0082e271 32