How to use ads1115.

Dependencies:   ADS1015 USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
arve0
Date:
Sun Nov 10 18:30:09 2013 +0000
Child:
1:02d947b2fdec
Commit message:
fix comment

Changed in this revision

ADS1015.lib Show annotated file Show diff for this revision Revisions of this file
USBDevice.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
mbed.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ADS1015.lib	Sun Nov 10 18:30:09 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/arve0/code/ADS1015/#8174d9ceeca1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Sun Nov 10 18:30:09 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#849c0c0f2769
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 10 18:30:09 2013 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+#include "Adafruit_ADS1015.h"
+#include "USBSerial.h"
+
+#define SERIAL_BAUD_RATE    9600
+
+I2C i2c(p23, p18);
+Adafruit_ADS1015 ads(&i2c);
+USBSerial pc; // USB CDC serial port
+
+ 
+int main() {
+    uint16_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
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Sun Nov 10 18:30:09 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/#f37f3b9c9f0b