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.
PC20.cpp
00001 //.cpp file for photocell, define coefficients and functions 00002 00003 #include "PC20.h" //include .h file to take variables/functions from class 00004 00005 PC20::PC20 (PinName in2): _in2(in2) { //PC20 function in class PC20, define pin 00006 //initialize coefficients- corresponds to photocell data 00007 A= -2; 00008 B= 3.8; 00009 R= 10000; 00010 V= 3.3; 00011 } //close PC20 00012 00013 float PC20::photo(){ //PC20 photocell computation function (double column) 00014 float pc_volt= _in2.read()*3.3;//read volt from defined pin, *3.3 to get volt from % 00015 float R1=((R/pc_volt)-V)/1000; 00016 float L= pow(10, A*log10(R1)+B);//lux formula with coefficients 00017 return L ; //returns value after function had been evaluated 00018 00019 } //close float PC
Generated on Thu Aug 4 2022 12:14:52 by
1.7.2