Use ADS1115

Dependencies:   mbed ADS1015

Files at this revision

API Documentation at this revision

Comitter:
LoloF
Date:
Tue Jun 04 12:08:23 2019 +0000
Parent:
1:02d947b2fdec
Commit message:
ADS1115

Changed in this revision

USBDevice.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
mbed.lib Show diff for this revision Revisions of this file
diff -r 02d947b2fdec -r 00320fd347da USBDevice.lib
--- a/USBDevice.lib	Sat Oct 11 08:57:10 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/USBDevice/#849c0c0f2769
diff -r 02d947b2fdec -r 00320fd347da main.cpp
--- a/main.cpp	Sat Oct 11 08:57:10 2014 +0000
+++ b/main.cpp	Tue Jun 04 12:08:23 2019 +0000
@@ -1,22 +1,28 @@
 #include "mbed.h"
 #include "Adafruit_ADS1015.h"
-#include "USBSerial.h"
+
 
 #define SERIAL_BAUD_RATE    9600
 
-I2C i2c(p23, p18);
+I2C i2c(PB_11, PB_10);
 Adafruit_ADS1115 ads(&i2c);
-USBSerial pc; // USB CDC serial port
+Serial pc(USBTX, USBRX); // lire sur le port serie du pc
 
 
 int main(){
     ads.setGain(GAIN_SIXTEEN); // set range to +/-0.256V
-    int reading;
+    int reading,reading1,reading2,reading3;
     while (1) {
         reading = ads.readADC_SingleEnded(0); // read channel 0
-        pc.printf("reading: %d\r\n", reading); // print reading
+        pc.printf("Entree0: %d\r\n", reading); // print reading
+        reading2 = ads.readADC_SingleEnded(2); // read channel 2
+        pc.printf("Entree2: %d\r\n", reading2); // print reading
+        reading1 = ads.readADC_SingleEnded(1); // read channel 1
+        pc.printf("Entree1: %d\r\n", reading1); // print reading
+        reading3 = ads.readADC_SingleEnded(3); // read channel 3
+        pc.printf("Entree3: %d\r\n", reading3); // print reading
         wait(2); // loop 2 sek
-        reading = ads.readADC_Differential_2_3(); // differential channel 2-3
-        pc.printf("diff a2, a3: %d\r\n", reading); // print diff
+        //reading = ads.readADC_Differential_2_3(); // differential channel 2-3
+       // pc.printf("diff a2, a3: %d\r\n", reading); // print diff
     }
 }
\ No newline at end of file
diff -r 02d947b2fdec -r 00320fd347da mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 04 12:08:23 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file
diff -r 02d947b2fdec -r 00320fd347da mbed.lib
--- a/mbed.lib	Sat Oct 11 08:57:10 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/#f37f3b9c9f0b