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.
Ammeter_Code.cpp
00001 /* 00002 the ammeter reads the voltage accross the shunt resister that is a set value 00003 this is used to calculate the current in the circuit 00004 a value for current will be printed in mA on the LCD screen 00005 00006 */ 00007 00008 00009 //Case x: 00010 lcd.locate(0.0) 00011 lcd.printf("Current: "); 00012 00013 00014 AnalogIn vo(A5); //reads the voltage across rshunt 00015 00016 double vout= (3.3*vo)/4095; //converts from bits in the analog read 00017 double rshunt = 0.01; //set value for rshunt 00018 int i; // declares a integer for i 00019 00020 00021 i = vout/rshunt; // equation to find i 00022 00023 if i<= 0.5{ 00024 00025 ifinal= i*1000; //converts into amps to mA 00026 lcd.locate(0,1); 00027 lcd.printf(".3f mA", ifinal); 00028 } 00029 else { 00030 lcd.locate(0,1); 00031 lcd.printf("out of range"); 00032 } 00033 //if and else staments here are based in if the i that has been found is within the parameters 00034 00035
Generated on Sat Jul 16 2022 00:07:19 by
1.7.2