How to use ads1015.

Dependencies:   ADS1015 USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
arve0
Date:
Wed Nov 20 17:18:34 2013 +0000
Parent:
0:ea70612a3ee1
Child:
2:7dabf69723a3
Commit message:
reading not unsigned

Changed in this revision

ADS1015.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ADS1015.lib	Sun Nov 10 18:30:09 2013 +0000
+++ b/ADS1015.lib	Wed Nov 20 17:18:34 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/arve0/code/ADS1015/#8174d9ceeca1
+http://mbed.org/users/arve0/code/ADS1015/#659ccb9047ed
--- a/main.cpp	Sun Nov 10 18:30:09 2013 +0000
+++ b/main.cpp	Wed Nov 20 17:18:34 2013 +0000
@@ -10,10 +10,13 @@
 
  
 int main() {
-    uint16_t reading;
+    ads.setGain(GAIN_SIXTEEN); // set range to +/-0.256V
+    int16_t reading;
     while (1) {
         reading = ads.readADC_SingleEnded(0); // read channel 0
         pc.printf("reading: %d\r\n", reading); // print reading
         wait(2); // loop 2 sek
+        reading = ads.readADC_Differential_2_3();
+        pc.printf("diff a2, a3: %d\r\n", reading); // print diff
     }
 }
\ No newline at end of file