Initial import of WAVE_ROVER_V1.0
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#define INA219_ADDRESS 0x42
|
||||
INA219_WE ina219 = INA219_WE(INA219_ADDRESS);
|
||||
|
||||
float shuntVoltage_mV = 0.0;
|
||||
float loadVoltage_V = 0.0;
|
||||
float busVoltage_V = 0.0;
|
||||
float current_mA = 0.0;
|
||||
float power_mW = 0.0;
|
||||
bool ina219_overflow = false;
|
||||
|
||||
void ina219_init(){
|
||||
if(!ina219.init()){
|
||||
Serial.println("INA219 not connected!");
|
||||
}
|
||||
ina219.setADCMode(BIT_MODE_9);
|
||||
ina219.setPGain(PG_320);
|
||||
ina219.setBusRange(BRNG_16);
|
||||
ina219.setShuntSizeInOhms(0.01); // used in INA219.
|
||||
}
|
||||
|
||||
void inaDataUpdate(){
|
||||
shuntVoltage_mV = ina219.getShuntVoltage_mV();
|
||||
busVoltage_V = ina219.getBusVoltage_V();
|
||||
current_mA = ina219.getCurrent_mA();
|
||||
power_mW = ina219.getBusPower();
|
||||
loadVoltage_V = busVoltage_V + (shuntVoltage_mV/1000);
|
||||
ina219_overflow = ina219.getOverflow();
|
||||
}
|
||||
Reference in New Issue
Block a user