Last active
May 19, 2021 10:51
-
-
Save neosarchizo/1f5c76454ab46e4d7ba8b3ff04b049b3 to your computer and use it in GitHub Desktop.
[Arduino] CM1106 & CM1107 Calibration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cm1106_i2c.h> | |
CM1106_I2C cm1106_i2c; | |
void setup() { | |
cm1106_i2c.begin(); | |
Serial.begin(9600); | |
delay(1000); | |
cm1106_i2c.read_serial_number(); | |
delay(1000); | |
cm1106_i2c.check_sw_version(); | |
delay(1000); | |
} | |
void loop() { | |
if (Serial.available()) { | |
String msg = Serial.readStringUntil('\r'); | |
int value = msg.toInt(); | |
Serial.print("value : "); | |
Serial.println(value); | |
uint8_t ret = cm1106_i2c.calibration(value); | |
if (ret == 0) { | |
Serial.println("Calibration success!"); | |
} else { | |
Serial.println("Calibration failed!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment