2021-08-23 13:33:25 -04:00
|
|
|
//
|
|
|
|
// FILE: MTP40C_selfCalibration.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// VERSION: 0.1.0
|
|
|
|
// PURPOSE: demo of MTP40C library
|
|
|
|
// DATE: 2021-08-23
|
|
|
|
// URL: https://github.com/RobTillaart/MTP40C
|
|
|
|
//
|
|
|
|
// any board that support two or more hardware serial ports
|
|
|
|
// Serial and Serial1, e.g. for MEGA, LEONARDO, MICRO, ESP32,ESP8266
|
|
|
|
// Uno, Nano or Mini will fail to compile.
|
|
|
|
|
|
|
|
|
|
|
|
#include "MTP40C.h"
|
2021-09-02 01:40:38 -04:00
|
|
|
#include "SoftwareSerial.h"
|
2021-08-23 13:33:25 -04:00
|
|
|
|
2021-09-02 01:40:38 -04:00
|
|
|
SoftwareSerial sws(6, 7);
|
|
|
|
MTP40C mtp(&sws);
|
|
|
|
// MTP40C mtp(&Serial1);
|
2021-08-23 13:33:25 -04:00
|
|
|
|
|
|
|
uint32_t start;
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
|
2021-09-02 01:40:38 -04:00
|
|
|
Serial.print("MTP40_LIB_VERSION:\t");
|
|
|
|
Serial.println(MTP40_LIB_VERSION);
|
2021-08-23 13:33:25 -04:00
|
|
|
|
2021-09-02 01:40:38 -04:00
|
|
|
sws.begin(19200);
|
|
|
|
mtp.begin(MTP40_DEFAULT_ADDRESS);
|
2021-08-23 13:33:25 -04:00
|
|
|
|
|
|
|
Serial.print("STAT:\t");
|
|
|
|
Serial.println(mtp.getSelfCalibrationStatus());
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
2021-08-23 13:33:25 -04:00
|
|
|
Serial.print("OPEN:\t");
|
|
|
|
Serial.println(mtp.openSelfCalibration());
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
2021-08-23 13:33:25 -04:00
|
|
|
Serial.print("STAT:\t");
|
|
|
|
Serial.println(mtp.getSelfCalibrationStatus());
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
2021-08-23 13:33:25 -04:00
|
|
|
Serial.print("CLOSE:\t");
|
|
|
|
Serial.println(mtp.closeSelfCalibration());
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
2021-08-23 13:33:25 -04:00
|
|
|
Serial.print("STAT:\t");
|
|
|
|
Serial.println(mtp.getSelfCalibrationStatus());
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
2021-08-23 13:33:25 -04:00
|
|
|
Serial.print("OPEN:\t");
|
|
|
|
Serial.println(mtp.openSelfCalibration());
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
|
|
|
Serial.print("STAT:\t");
|
|
|
|
Serial.println(mtp.getSelfCalibrationStatus());
|
|
|
|
delay(100);
|
|
|
|
|
2021-08-23 13:33:25 -04:00
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
Serial.print("GET_HRS:\t");
|
|
|
|
uint16_t hrs = mtp.getSelfCalibrationHours();
|
|
|
|
Serial.println(hrs);
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
2021-08-23 13:33:25 -04:00
|
|
|
|
|
|
|
if (hrs > 720) hrs = 23;
|
|
|
|
Serial.print("SET_HRS:\t");
|
|
|
|
Serial.println(mtp.setSelfCalibrationHours(hrs + 1));
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
2021-08-23 13:33:25 -04:00
|
|
|
Serial.print("GET_HRS:\t");
|
|
|
|
Serial.println(mtp.getSelfCalibrationHours());
|
2021-09-02 01:40:38 -04:00
|
|
|
delay(100);
|
2021-08-23 13:33:25 -04:00
|
|
|
|
|
|
|
Serial.println("\ndone...");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -- END OF FILE --
|