11/*
2+ microfire.co for links to documentation, examples, and libraries
3+ github.com/u-fire for feature requests, bug reports, and questions
4+ questions@ufire.co to get in touch with someone
5+
6+ Mod-ORP hardware version 2, firmware 1
7+
28 This allows you to run various functions in a command-line like interface.
39 Enter:
410 `config` to see the configuration of the device.
511 'reset' to reset all the configuration stored in the device
6-
712 Measure ORP:
813 `orp`
9-
1014 Single Point Calibration:
11- sin <calibration solution in pH> <solution temp [25]>
12- `sin 60.0 t` - Calibrate at 600.0 mV
13-
15+ sin <calibration solution in mV>
16+ `sin 600` - Calibrate at 600.0 mV
1417 Measure Temperature:
1518 temp
16-
1719 Change the I2C address:
1820 i2c 0x0F
1921*/
2022
2123#include < Arduino.h>
2224#include < Wire.h>
23- #include " uFire_Mod -ORP.h"
25+ #include " Microfire_Mod -ORP.h"
2426
25- uFire ::Mod_ORP::i2c orp;
27+ Microfire ::Mod_ORP::i2c orp;
2628
2729String buffer, cmd, p1, p2;
2830const int fw_compatible = 1 ;
29- const int hw_compatible = 1 ;
31+ const int hw_compatible = 2 ;
3032
3133void config ()
3234{
3335 orp.getDeviceInfo ();
34- Serial.println ((String) " uFire Mod-ORP Sensor: " + (orp.connected () ? " connected" : " *disconnected*" ));
36+ Serial.println ((String) " Microfire Mod-ORP Sensor: " + (orp.connected () ? " connected" : " *disconnected*" ));
3537 if (!orp.connected ()) return ;
3638 if ((orp.fwVersion != fw_compatible) || (orp.hwVersion != hw_compatible))
3739 {
@@ -52,23 +54,6 @@ void config_reset()
5254 config ();
5355}
5456
55- void temperature ()
56- {
57- orp.measureTemp ();
58- switch (orp.status )
59- {
60- case orp.STATUS_SYSTEM_ERROR :
61- Serial.println (" Error: no temperature sensor connected" );
62- break ;
63- case orp.STATUS_NO_ERROR :
64- Serial.print (" C|F: " );
65- Serial.print (orp.tempC );
66- Serial.print (" | " );
67- Serial.println (orp.tempF );
68- break ;
69- }
70- }
71-
7257void i2c ()
7358{
7459 uint8_t i2c_address;
@@ -104,7 +89,7 @@ void measure_orp()
10489 Serial.println (" Error: Module not functioning properly" );
10590 break ;
10691 case orp.STATUS_NO_ERROR :
107- Serial.print (orp.mV , 3 );
92+ Serial.print (orp.mV );
10893 Serial.println ((String)" mV" );
10994 break ;
11095 }
@@ -128,20 +113,18 @@ void single()
128113
129114void help ()
130115{
131- Serial.println (F (" List of available commands, parameters separated by spaces, `low 4.0 22.1`, bracketed numbers are defaults if none provided " ));
116+ Serial.println (F (" List of available commands, parameters separated by spaces" ));
132117 Serial.println (F (" config -or- c : no parameters : Displays all configuration and system information." ));
133118 Serial.println (F (" orp : no parameters : Starts an ORP measurement." ));
134119 Serial.println (F (" i2c : I2C_address : Changes the module's I2C address." ));
135120 Serial.println (F (" reset -or- r : no parameters : Returns all configuration information to default values." ));
136121 Serial.println (F (" sin : calibration_mV : Single-point calibration." ));
137- Serial.println (F (" temp -or- t : no parameters : Starts a temperature measurement" ));
138122}
139123
140124void cmd_run ()
141125{
142126 if ((cmd == " conf" ) || (cmd == " config" ) || (cmd == " c" )) config ();
143127 if ((cmd == " reset" ) || (cmd == " r" )) config_reset ();
144- if ((cmd == " temp" ) || (cmd == " t" )) temperature ();
145128 if (cmd == " sin" ) single ();
146129 if (cmd == " i2c" ) i2c ();
147130 if (cmd == " orp" ) measure_orp ();
0 commit comments