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
- Committer:
- thomasosullivan
- Date:
- 2020-04-01
- Revision:
- 3:b6e887e4ac75
- Parent:
- 0:7f4ed364f7ea
File content as of revision 3:b6e887e4ac75:
/* the ammeter reads the voltage accross the shunt resister that is a set value this is used to calculate the current in the circuit a value for current will be printed in mA on the LCD screen */ //Case x: lcd.locate(0.0) lcd.printf("Current: "); AnalogIn vo(A5); //reads the voltage across rshunt double vout= (3.3*vo)/4095; //converts from bits in the analog read double rshunt = 0.01; //set value for rshunt int i; // declares a integer for i i = vout/rshunt; // equation to find i if i<= 0.5{ ifinal= i*1000; //converts into amps to mA lcd.locate(0,1); lcd.printf(".3f mA", ifinal); } else { lcd.locate(0,1); lcd.printf("out of range"); } //if and else staments here are based in if the i that has been found is within the parameters