[chronojump] Testing MCP3304 ADC



commit 71d998a55d045be59b191df2a83d4f1774fe05eb
Author: Xavier Padullés <x padulles gmail com>
Date:   Thu Jan 17 17:15:09 2019 +0100

    Testing MCP3304 ADC

 arduino/ForceSensor4Binary/ForceSensor4Binary.ino | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/arduino/ForceSensor4Binary/ForceSensor4Binary.ino 
b/arduino/ForceSensor4Binary/ForceSensor4Binary.ino
index 38f4d2b3..723bbfb5 100644
--- a/arduino/ForceSensor4Binary/ForceSensor4Binary.ino
+++ b/arduino/ForceSensor4Binary/ForceSensor4Binary.ino
@@ -16,10 +16,9 @@
 */
 
 #include <Wire.h>
-#include <Adafruit_ADS1015.h>
-#include <EEPROM.h>
+#include <MCP3304.h>
 
-Adafruit_ADS1015 loadCell;
+MCP3304 loadCell(10);
 
 
 //Version number
@@ -42,8 +41,6 @@ void setup(void)
 
   Serial.begin(115200);
 
-  loadCell.begin();
-  loadCell.setGain(GAIN_TWO);
   tare();
   // Serial.println("taring complete");
 }
@@ -103,7 +100,7 @@ void tare(void)
   {
     for (int sensor = 0; sensor <= 3; sensor++)
     {
-      total[sensor] += loadCell.readADC_SingleEnded(sensor);
+      total[sensor] += loadCell.readAdc(sensor,1);
     }
   }
 
@@ -116,7 +113,7 @@ void tare(void)
 
 int readOffsetedData(int sensor)
 {
-  return (loadCell.readADC_SingleEnded(sensor) - offset[sensor]);
+  return (loadCell.readAdc(sensor,1) - offset[sensor]);
 }
 
 void calibrate(float load)
@@ -221,4 +218,3 @@ void get_version()
 {
   Serial.println(version);
 }
-


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]