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.
Dependents: Hybrid_IZU2021_MAIN_OS5 Hybrid_IZU2021_MAIN
INA226 Class Reference
電圧電流センサINA226のライブラリ(シャント抵抗0.002Ω) More...
#include <PQ_INA226.h>
Public Member Functions | |
| INA226 (I2C &i2c, A0_t A0, A1_t A1) | |
| void | begin () |
| センサ動作開始 | |
| bool | test () |
| センサ通信テスト | |
| void | read (float *voltage, float *current, float *power) |
| 測定値読み取り | |
| void | read_voltage (float *voltage) |
| 電圧測定値読み取り | |
| void | read_current (float *current) |
| 電流測定値読み取り | |
| void | read_power (float *power) |
| 電力測定値読み取り | |
Detailed Description
電圧電流センサINA226のライブラリ(シャント抵抗0.002Ω)
#include "mbed.h" #include "PQ_INA226.h" Serial pc(USBTX, USBRX, 115200); I2C i2c(p9, p10); INA226 ina(i2c, INA226::A0_GND, INA226::A1_GND); float voltage, current, power; int main() { ina.begin(); while(true) { if(ina.test()) { ina.read(&voltage, ¤t, &power); pc.printf("%f\t%f\t%f\r\n", voltage, current, power); } else { pc.printf("ERROR!!\r\n"); } } }
Definition at line 39 of file PQ_INA226.h.
Constructor & Destructor Documentation
| INA226 | ( | I2C & | i2c, |
| A0_t | A0, | ||
| A1_t | A1 | ||
| ) |
- Parameters:
-
i2c I2Cのインスタンスへの参照 A0 A0のジャンパ A1 A1のジャンパ
Definition at line 4 of file PQ_INA226.cpp.
Member Function Documentation
| void begin | ( | ) |
センサ動作開始
Definition at line 11 of file PQ_INA226.cpp.
| void read | ( | float * | voltage, |
| float * | current, | ||
| float * | power | ||
| ) |
測定値読み取り
- Parameters:
-
voltage 電圧を格納する変数へのポインタ current 電流を格納する変数へのポインタ power 電力を格納する変数へのポインタ
Definition at line 30 of file PQ_INA226.cpp.
| void read_current | ( | float * | current ) |
| void read_power | ( | float * | power ) |
| void read_voltage | ( | float * | voltage ) |
| bool test | ( | ) |
Generated on Tue Aug 16 2022 14:45:22 by
1.7.2