Ai
1 Star 0 Fork 0

DFRobot/DFRobot_PH

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
DFRobot_PH.h 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
LattePanda 提交于 2023-11-14 19:54 +08:00 . compatible with arduino r4
/*!
* @file DFRobot_PH.h
* @brief Arduino library for Gravity: Analog pH Sensor / Meter Kit V2, SKU: SEN0161-V2
*
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [Jiawei Zhang](jiawei.zhang@dfrobot.com)
* @version V1.0
* @date 2018-11-06
* @url https://github.com/DFRobot/DFRobot_PH
*/
#ifndef _DFROBOT_PH_H_
#define _DFROBOT_PH_H_
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define ReceivedBufferLength 10 //length of the Serial CMD buffer
class DFRobot_PH
{
public:
DFRobot_PH();
~DFRobot_PH();
/**
* @fn calibration
* @brief Calibrate the calibration data
*
* @param voltage : Voltage value
* @param temperature : Ambient temperature
* @param cmd : enterph -> enter the PH calibration mode
* @n calph -> calibrate with the standard buffer solution, two buffer solutions(4.0 and 7.0) will be automaticlly recognized
* @n exitph -> save the calibrated parameters and exit from PH calibration mode
*/
void calibration(float voltage, float temperature,char* cmd); //calibration by Serial CMD
void calibration(float voltage, float temperature);
/**
* @fn readPH
* @brief Convert voltage to PH with temperature compensation
* @note voltage to pH value, with temperature compensation
*
* @param voltage : Voltage value
* @param temperature : Ambient temperature
* @return The PH value
*/
float readPH(float voltage, float temperature);
/**
* @fn begin
* @brief Initialization The Analog pH Sensor
*/
void begin();
private:
float _phValue;
float _acidVoltage;
float _neutralVoltage;
float _voltage;
float _temperature;
char _cmdReceivedBuffer[ReceivedBufferLength]; //store the Serial CMD
byte _cmdReceivedBufferIndex;
private:
boolean cmdSerialDataAvailable();
void phCalibration(byte mode); // calibration process, wirte key parameters to EEPROM
byte cmdParse(const char* cmd);
byte cmdParse();
char* strupr(char* str);
};
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/dfrobot/DFRobot_PH.git
git@gitee.com:dfrobot/DFRobot_PH.git
dfrobot
DFRobot_PH
DFRobot_PH
master

搜索帮助