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.
Dependents: 595_Project2_Hydro
phread.cpp
00001 #include "phread.h" 00002 00003 PHread::PHread (PinName data_pin) : 00004 _datapin (data_pin) 00005 {} 00006 00007 float PHread::get_pH(){ 00008 float mv_voltage = 0; 00009 float ph_val=0; 00010 00011 00012 for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value 00013 { 00014 mv_voltage += (_datapin.read() * 3.1); 00015 wait_ms(10); 00016 } 00017 mv_voltage /= 10; 00018 00019 //formuala to convert from voltage signal to ph 00020 //from atlasScientific 00021 ph_val = (-5.6548 * mv_voltage) + 15.509; 00022 00023 00024 00025 return ph_val; 00026 }
Generated on Tue Jul 12 2022 17:19:00 by
1.7.2