Dimple Bhuta / Mbed 2 deprecated forcesensor_v2

Dependencies:   mbed

Fork of forcesensor_v1 by Dimple Bhuta

Files at this revision

API Documentation at this revision

Comitter:
DimpleB05
Date:
Wed Mar 29 07:38:23 2017 +0000
Parent:
0:811dd69a17ee
Commit message:
forcesensor_mbedcode;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Mar 03 09:12:55 2017 +0000
+++ b/main.cpp	Wed Mar 29 07:38:23 2017 +0000
@@ -4,19 +4,24 @@
  
 AnalogIn in(A0);
 Serial pc(USBTX, USBRX);
+Ticker tmr;
+
 int in_value=0;
 float voltage = 0;
  
+void read_adc ()
+{
+  in_value = in.read_u16()>> 4;     
+  pc.printf("%d\n",in_value);
+}
+ 
 int main() {
   pc.baud(BAUDRate);
-  pc.printf("Clock speed: %d\r\n", SystemCoreClock);
   
+  tmr.attach(&read_adc, 0.01);
   while(1) {
-    
-    in_value = in.read_u16()>>4;
-    voltage = (in_value * 3.3)/4096;
-    pc.printf("%d,%f\r\n",in_value, voltage);
-    wait(1);
+    //;
+
   }
  
 }
\ No newline at end of file