Skip to content

Instantly share code, notes, and snippets.

@neosarchizo
Last active May 19, 2021 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neosarchizo/1f5c76454ab46e4d7ba8b3ff04b049b3 to your computer and use it in GitHub Desktop.
Save neosarchizo/1f5c76454ab46e4d7ba8b3ff04b049b3 to your computer and use it in GitHub Desktop.
[Arduino] CM1106 & CM1107 Calibration
#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