public class ResistorCurrent extends java.lang.Object implements CurrentReadable
CurrentReadable
.Modifier and Type | Field and Description |
---|---|
float |
ohms
Resistance in Ohms
|
VoltageReadable |
voltmeter
Readout of voltage across resistor
|
Constructor and Description |
---|
ResistorCurrent(float ohms,
VoltageReadable voltmeter)
Create object to indirectly measure current through a resistor.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Unit test
|
float |
readCurrent()
Returns voltage across resistor divided by resistance.
|
float |
readCurrent(float ampsExpected,
float ampsResolution)
Returns voltage across resistor divided by resistance.
|
public float ohms
public VoltageReadable voltmeter
public ResistorCurrent(float ohms, VoltageReadable voltmeter)
ohms
- Resistance in Ohmsvoltmeter
- Readout of voltage across resistorpublic float readCurrent()
readCurrent
in interface CurrentReadable
CurrentReadable.readCurrent()
public float readCurrent(float ampsExpected, float ampsResolution)
readCurrent
in interface CurrentReadable
ampsExpected
- expected value of current in amps, for range settingampsResolution
- desired resolution for measurement, in ampsCurrentReadable.readCurrent()
public static void main(java.lang.String[] args)