Samir Bouaziz
/
TSL230essai
test de TSL230 circuit conversion lumière/frequence
Diff: main.cpp
- Revision:
- 1:0ef745d284a1
- Parent:
- 0:94a3a01d13c2
--- a/main.cpp Thu Oct 13 22:24:09 2011 +0000 +++ b/main.cpp Wed Oct 19 18:56:53 2011 +0000 @@ -17,6 +17,7 @@ #include "mbed.h" +#include "math.h" Serial pc(USBTX, USBRX); @@ -33,7 +34,7 @@ t.start(); n++; break; - case 1 : + // case 1 : case 10: t.stop(); per=t.read_us(); n=0; @@ -51,14 +52,15 @@ int main() { - +float mes; // in.mode(PullUp); // Set the pin to Pull Down mode. in.rise(&itup); // Set up the interrupt for rising edge // in.fall(&itdown); // Set up the interrupt for rising edge while (1) { wait(1); //freq= 100000.0/((float)per); - pc.printf("val= %f \r",1000000./(float)per); + mes=(10000./((float)per))/0.0069; + pc.printf("%f %f\r\n",mes,10000000./((float)per)); } }