Skip to content

Commit

Permalink
removed tc and dp
Browse files Browse the repository at this point in the history
  • Loading branch information
justind000 committed Mar 22, 2019
1 parent d346c0f commit 7e91e52
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 480 deletions.
3 changes: 1 addition & 2 deletions examples/BLE/BLE.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ void setup()
void loop()
{
// loop through and take continous measurements
ec_ble.measureEC();
ec_ble.measureTemp();
ec_ble.measureEC(ec_ble.measureTemp());
}
11 changes: 1 addition & 10 deletions examples/Calibration/Calibration.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
github.com/u-fire for feature requests, bug reports, and questions
[email protected] to get in touch with someone
This example is compatible with Isolated EC Probe Interface
hardware version 1, firmware version 1.
It show's a user interactive dual point calibration routine.
*/

Expand All @@ -19,17 +16,11 @@ void setup()

// reset the configuration
ec.reset();

// make sure temperature compensation is turned off
ec.useTemperatureCompensation(false);


// use the EC value listed under the current temperature to calibrate
// eg. if the temperature of the calibration solution is 20 C, use the
// mS/cm value listed for that temperature
ec.calibrateProbe(1.413);

// turn temperature compensation on
ec.useTemperatureCompensation(true);
}

void loop()
Expand Down
3 changes: 0 additions & 3 deletions examples/Minimal/Minimal.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
ufire.co for links to documentation, examples, and libraries
github.com/u-fire for feature requests, bug reports, and questions
[email protected] to get in touch with someone
This example is compatible with Isolated EC Probe Interface
hardware version 1, firmware version 1.
It demonstrates the minimal amount of code and setup to take a reading from
a calibrated device.
Expand Down
42 changes: 0 additions & 42 deletions examples/OutsideTempSource/OutsideTempSource.ino

This file was deleted.

3 changes: 0 additions & 3 deletions examples/SAMD21/SAMD21.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
ufire.co for links to documentation, examples, and libraries
github.com/u-fire for feature requests, bug reports, and questions
[email protected] to get in touch with someone
This example is compatible with Isolated EC Probe Interface
hardware version 1, firmware version 1.
There is a slight difference in the SAMD21 core. The only difference
between this example and all the others is that `Wire.begin();` is
Expand Down
153 changes: 37 additions & 116 deletions examples/Shell/Shell.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,26 @@
Enter:
`config` to see the configuration of the device.
'ec' to get a measurement in mS
'sal' to measure seawater
'data' to see all the data members of the class like uS, and S
'temp' to read the temperature
'reset' to reset all the configuration stored in the device
Using Temperature compensation with attached temperature sensor:
tc 1 25 <to adjust readings as if they were at 25 C>
tc 0 <to disable compensation>
Single Point Calibration:
cal 2.0 <to calibrate in a 2.0 mS/cm solution>
Dual Point Calibration:
low 0.7 <to calibrate the low value as 0.7 mS/cm>
high 2.0 <to calibrate the high value as 2.0 mS/cm>
dp 1 <to turn dual point on>
Set a temperature to use:
t 20 <to use 20 C as the temperature rather than using the attached temp. sensor>
Measure Temperature:
temp
Measure EC:
ec
ec x <take an EC measurement every x milliseconds>
Measure saltwater:
sal
sal x <take a seawater measurement every x milliseconds>
ec <current temperature> <temperature to adjust to>
Display results in PPM 500:
tds
tds x <take a measurement every x milliseconds>
Change the I2C address:
i2c 3d <address is a interpreted as a hex number without the 0x>
Expand All @@ -45,6 +31,8 @@
read 300 <returns a float stored at address 300>
write 300 123.4 <writes 123.4 at address 300>
*/

#include <Arduino.h>
#include "uFire_EC.h"

#ifdef ESP32
Expand All @@ -61,20 +49,19 @@ void config()
Serial.println(EC.connected() ? "connected" : "*disconnected*");
Serial.println("calibration:");
Serial.print(" offset: "); Serial.println(EC.getCalibrateOffset(), 4);
Serial.print(" dual point: "); Serial.println(EC.usingDualPoint() ? "yes" : "no");
Serial.println(" dual point: ");
Serial.print(" low reference / read: "); Serial.print(EC.getCalibrateLowReference(), 4);
Serial.print(" / "); Serial.println(EC.getCalibrateLowReading(), 4);
Serial.print(" high reference / read: "); Serial.print(EC.getCalibrateHighReference(), 4);
Serial.print(" / "); Serial.println(EC.getCalibrateHighReading(), 4);
Serial.print("temp. compensation: ");
Serial.println(EC.usingTemperatureCompensation() ? "yes" : "no");
Serial.println("temp. compensation: ");
Serial.print(" constant: ");
Serial.println(EC.getTempConstant());
Serial.print(" coefficient: ");
Serial.println(EC.getTempCoefficient(), 3);
Serial.print("H/W version: ");
Serial.println(EC.getVersion(), HEX);
Serial.print("F/W version: ");
Serial.print("hardware/firmware version: ");
Serial.print(EC.getVersion(), HEX);
Serial.print(":");
Serial.println(EC.getFirmware(), HEX);
}

Expand All @@ -85,14 +72,7 @@ void config_reset()

void temperature()
{
if (p1.length())
{
EC.setTemp(p1.toFloat());
}
else
{
EC.measureTemp();
}
EC.measureTemp();
Serial.print("C|F: ");
Serial.print(EC.tempC);
Serial.print(" | ");
Expand Down Expand Up @@ -123,34 +103,6 @@ void data()
Serial.println(EC.tempF);
}

void temp_comp()
{
if (p1.length())
{
EC.useTemperatureCompensation(p1.toInt());
}

if (p2.length())
{
EC.useTemperatureCompensation(p1.toInt());
EC.setTempConstant(p2.toFloat());
}

Serial.print("temp. compensation: ");
Serial.println(EC.usingTemperatureCompensation() ? "yes" : "no");
Serial.print(" constant: ");
Serial.println(EC.getTempConstant());
}

void dual_point() {
if (p1.length()) {
EC.useDualPoint(p1.toInt());
}

Serial.print("dual point: ");
Serial.println(EC.usingDualPoint() ? "yes" : "no");
}

void i2c()
{
if (p1.length())
Expand All @@ -161,102 +113,73 @@ void i2c()

void ec()
{
if (p1.length())
while (Serial.available() == 0)
{
while (Serial.available() == 0)
if (p2.length())
{
EC.measureEC(false);
EC.measureEC(p1.toFloat(), p2.toFloat());
Serial.print("mS/cm: ");
Serial.println(EC.mS, 4);
delay(p1.toInt());
}
}
else
{
EC.measureEC(false);
Serial.print("mS/cm: ");
Serial.println(EC.mS, 4);
else if (p1.length())
{
EC.measureEC(p1.toFloat());
Serial.print("mS/cm: ");
Serial.println(EC.mS, 4);
}
else
{
EC.measureEC();
Serial.print("mS/cm: ");
Serial.println(EC.mS, 4);
}
delay(1000);
}
}

void tds()
{
if (p1.length())
{
while (Serial.available() == 0)
{
EC.measureEC(false);
EC.measureEC();
Serial.print("tds: ");
Serial.println(EC.PPM_500);
delay(p1.toInt());
delay(1000);
}
}
else
{
EC.measureEC(false);
Serial.print("tds: ");
Serial.println(EC.PPM_500);
}
}

void raw()
{
if (p1.length())
{
while (Serial.available() == 0)
{
EC.measureEC(false);
EC.measureEC();
Serial.print("raw: ");
Serial.println(EC.raw);
delay(p1.toInt());
}
}
else
{
EC.measureEC(false);
Serial.print("raw: ");
Serial.println(EC.raw);
}
}

void sal()
{
if (p1.length())
{
while (Serial.available() == 0)
{
EC.measureEC(false);
Serial.print("salinity PSU: ");
Serial.println(EC.salinityPSU, 2);
delay(p1.toInt());
delay(1000);
}
}
else
{
EC.measureEC(false);
Serial.print("salinity PSU: ");
Serial.println(EC.salinityPSU, 2);
}
}

void low() {
if (p1.length()) {
if (p1.length())
{
EC.calibrateProbeLow(p1.toFloat());
}
Serial.print("low reference | read: "); Serial.print(EC.getCalibrateLowReference(), 2);
Serial.print(" | "); Serial.println(EC.getCalibrateLowReading(), 2);
}

void high() {
if (p1.length()) {
if (p1.length())
{
EC.calibrateProbeHigh(p1.toFloat());
}
Serial.print("high reference | read: "); Serial.print(EC.getCalibrateHighReference(), 2);
Serial.print(" | "); Serial.println(EC.getCalibrateHighReading(), 2);
}

void calibrate() {
if (p1.length()) {
if (p1.length())
{
EC.calibrateProbe(p1.toFloat());
}

Expand All @@ -265,7 +188,8 @@ void calibrate() {
}

void coeffieicnet() {
if (p1.length()) {
if (p1.length())
{
EC.setTempCoefficient(p1.toFloat());
}

Expand Down Expand Up @@ -296,13 +220,10 @@ void cmd_run()
if ((cmd == "temp") || (cmd == "t")) temperature();
if ((cmd == "data") || (cmd == "d")) data();
if ((cmd == "calibrate") || (cmd == "cal")) calibrate();
if (cmd == "dp") dual_point();
if (cmd == "low") low();
if (cmd == "high") high();
if (cmd == "tc") temp_comp();
if (cmd == "i2c") i2c();
if (cmd == "ec") ec();
if (cmd == "sal") sal();
if (cmd == "raw") raw();
if (cmd == "read") read();
if (cmd == "write") write();
Expand Down
3 changes: 0 additions & 3 deletions examples/Temperature/Temperature.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
ufire.co for links to documentation, examples, and libraries
github.com/u-fire for feature requests, bug reports, and questions
[email protected] to get in touch with someone
This example is compatible with Isolated EC Probe Interface
hardware version 1, firmware version 1.
It demonstrates the minimal amount of code to take a temperature reading.
*/
Expand Down
Loading

0 comments on commit 7e91e52

Please sign in to comment.