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: IZU2020_AVIONICS IZU2020_AVIONICS
INA226 Class Reference
電圧電流センサINA226のライブラリ More...
#include <PQINA226.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のライブラリ
#include "mbed.h" #include "PQINA226.h" Serial pc(USBTX, USBRX, 115200); I2C i2c(p9, p10); INA226 ina(i2c, A0_GND, A1_GND); float voltage; float current; float 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("[ FAIL ] INA226 cannot be reached.\r\n"); } } }
Definition at line 40 of file PQINA226.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 PQINA226.cpp.
Member Function Documentation
| void begin | ( | ) |
センサ動作開始
Definition at line 11 of file PQINA226.cpp.
| void read | ( | float * | voltage, |
| float * | current, | ||
| float * | power | ||
| ) |
測定値読み取り
- Parameters:
-
voltage 電圧を格納する変数へのポインタ current 電流を格納する変数へのポインタ power 電力を格納する変数へのポインタ
Definition at line 31 of file PQINA226.cpp.
| void read_current | ( | float * | current ) |
| void read_power | ( | float * | power ) |
| void read_voltage | ( | float * | voltage ) |
| bool test | ( | ) |
Generated on Fri Jul 22 2022 20:45:36 by
1.7.2