Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
I2C_IIC
电流
RTduino添加INA219软件包,使用IIC通信读取数据不正常?
发布于 2024-03-29 10:44:51 浏览:356
订阅该版
BSP路径:rt-thread-master\bsp\stm32\stm32f103-blue-pill 问题描述:  添加软件包INA219 开启IIC硬件    编译仿真程序后测试,发现以下IIC初始化断点处未执行。  list device查看是有IIC总线的  INA219返回数据一直是这个  ```c //arduino_main.cpp代码如下 #include
#include
Adafruit_INA219 ina219; void setup(void) { Serial.begin(115200); while (!Serial) { // will pause Zero, Leonardo, etc until serial console opens delay(1); } Serial.println("Hello!"); // Initialize the INA219. // By default the initialization will use the largest range (32V, 2A). However // you can call a setCalibration function to change this range (see comments). if (! ina219.begin()) { Serial.println("Failed to find INA219 chip"); while (1) { delay(10); } } // To use a slightly lower 32V, 1A range (higher precision on amps): //ina219.setCalibration_32V_1A(); // Or to use a lower 16V, 400mA range (higher precision on volts and amps): //ina219.setCalibration_16V_400mA(); Serial.println("Measuring voltage and current with INA219 ..."); } void loop(void) { float shuntvoltage = 0; float busvoltage = 0; float current_mA = 0; float loadvoltage = 0; float power_mW = 0; shuntvoltage = ina219.getShuntVoltage_mV(); busvoltage = ina219.getBusVoltage_V(); current_mA = ina219.getCurrent_mA(); power_mW = ina219.getPower_mW(); loadvoltage = busvoltage + (shuntvoltage / 1000); Serial.print("Bus Voltage: "); Serial.print(busvoltage); Serial.println(" V"); Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV"); Serial.print("Load Voltage: "); Serial.print(loadvoltage); Serial.println(" V"); Serial.print("Current: "); Serial.print(current_mA); Serial.println(" mA"); Serial.print("Power: "); Serial.print(power_mW); Serial.println(" mW"); Serial.println(""); delay(2000); } ```
查看更多
1
个回答
默认排序
按发布时间排序
aozima
2024-03-29
调网络不抓包,调I2C等时序不上逻辑分析仪,就像电工不用万用表!多用整理的好的文字,比截图更省流量,还能在整理过程中思考。
接上逻辑分析仪
撰写答案
登录
注册新账号
关注者
0
被浏览
356
关于作者
aeniac
这家伙很懒,什么也没写!
提问
19
回答
42
被采纳
1
关注TA
发私信
相关问题
1
NXP的I2C应该比ST的好用吧
2
Use of I2C device driver
3
关于I2C 驱动问题请教
4
我如何知道这个iic的io配置和我电路设计的是一致的?
5
I2C模拟读操作失败,不知道问什么进不去读函数
6
RTT的I2C有官方文档资料没有
7
求 STM32F103 IIC 自定义IO初始化 代码
8
报一个LPC4008代码中I2C的bug
9
RTOS IIC总线使用
10
关于在RTT中使用STM32 I2C的疑问
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
【CFP】2025 RT-Thread全球技术大会演讲征集开始啦!
2
在 RT-Thread Studio 环境中为 ART-Pi 2 移植 CherryUSB(以 usb_device 为例)
3
嵌入式ARM RISCV toolchain工具 梳理arm-none-eabi-gcc
4
使用官方BOOT升级,看这一篇就够了?(以STM32F407VGT6为例)
5
可以使用MQTT连接AI大模型吗
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
rt-smart
FAL
I2C_IIC
cubemx
ESP8266
WIZnet_W5500
UART
ota在线升级
BSP
PWM
flash
packages_软件包
freemodbus
潘多拉开发板_Pandora
ADC
GD32
定时器
flashDB
编译报错
keil_MDK
socket
中断
rt_mq_消息队列_msg_queue
Debug
SFUD
msh
ulog
C++_cpp
at_device
本月问答贡献
聚散无由
9
个答案
6
次被采纳
RTT_逍遥
7
个答案
2
次被采纳
a1012112796
5
个答案
2
次被采纳
加缪
2
个答案
2
次被采纳
踩姑娘的小蘑菇
9
个答案
1
次被采纳
本月文章贡献
wake_mirco
2
篇文章
7
次点赞
mushroom
1
篇文章
9
次点赞
张世争
1
篇文章
7
次点赞
RTT_逍遥
1
篇文章
5
次点赞
Jack_____
1
篇文章
5
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部