Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CN0216_Diag.cpp
00001 #include "mbed.h" 00002 #include <stdio.h> 00003 #include <vector> 00004 #include <string> 00005 00006 #include "CN0216_Diag.h" 00007 00008 extern Serial pc; 00009 extern vector<string> cmdbuffer; 00010 00011 CN0216_Diag::CN0216_Diag(CN0216& cn) : dut(cn) 00012 { 00013 00014 } 00015 00016 void CN0216_Diag::init(void) 00017 { 00018 uint16_t weight = strtol(cmdbuffer[1].c_str(), NULL, 10); 00019 pc.printf("CN0216 initialized with %d calibration weight", weight); 00020 dut.init(weight); 00021 } 00022 00023 void CN0216_Diag::calibrate(void) 00024 { 00025 uint8_t step = strtol(cmdbuffer[1].c_str(), NULL, 16); 00026 pc.printf("Calibrating step %d ..", step); 00027 dut.calibrate(static_cast<CN0216::CalibrationStep_t>(step)); 00028 pc.printf(".. DONE", step); 00029 } 00030 00031 void CN0216_Diag::read_weight(void) 00032 { 00033 pc.printf("Read weight is %f", dut.read_weight()); 00034 } 00035
Generated on Tue Jul 12 2022 17:59:52 by
1.7.2
CN0357 - Toxic gas measurement
CN0216 - Weight Scale