“Microduino-Module BM Li-ion/zh”的版本间的差异
(→开发) |
(→开发) |
||
| 第41行: | 第41行: | ||
*电量计算: | *电量计算: | ||
<source lang="cpp"> | <source lang="cpp"> | ||
| − | // | + | |
| + | //电压检测引脚,BM Shield默认是A7引脚 | ||
#define PIN_bat A7 //BAT | #define PIN_bat A7 //BAT | ||
| − | + | //MCU工作电压,需要根据情况选择 | |
| − | #define | + | #define MCU_VOLTAGE 50 |
| + | //#define MCU_VOLTAGE 33 | ||
| − | + | #define _V_max 41 //4.2V | |
| − | + | #define _V_min 35 //3.7V | |
| − | |||
| − | |||
| − | # | ||
| − | |||
| − | # | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
#define _V_fix 0.2 //fix battery voltage | #define _V_fix 0.2 //fix battery voltage | ||
| 第64行: | 第56行: | ||
uint8_t batVoltage() { | uint8_t batVoltage() { | ||
| − | return constrain(_V_math( | + | return constrain(_V_math(MCU_VOLTAGE), _V_min, _V_max); |
} | } | ||
| + | |||
</source> | </source> | ||
2016年2月2日 (二) 07:58的版本
| Language | English |
|---|
|
原模块参考Microduino-Module_BM_Li-ion(old)/zh。
特色
规格
引脚说明 供电
文档主要元件
开发
//电压检测引脚,BM Shield默认是A7引脚
#define PIN_bat A7 //BAT
//MCU工作电压,需要根据情况选择
#define MCU_VOLTAGE 50
//#define MCU_VOLTAGE 33
#define _V_max 41 //4.2V
#define _V_min 35 //3.7V
#define _V_fix 0.2 //fix battery voltage
#define _V_math(Y) (_V_fix+((Y*analogRead(PIN_bat)/1023.0f)/(33.0f/(51.0f+33.0f))))
uint8_t batVoltage() {
return constrain(_V_math(MCU_VOLTAGE), _V_min, _V_max);
}
应用
问题解答历史
图库 |

