popo-fir popo-la
UNITED STATES OF AMERICA • + Follow
Edit Project
Description
dfasfasgf425134556
#include <LiquidCrystal.h> #include <JC_Button.h> const float Low_BAT_level = 3.2; //Current steps with a 3R load (R7) const int Current[] = {0, 37, 70, 103, 136, 169, 202, 235, 268, 301, 334, 367, 400, 440, 470, 500, 540}; const byte RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7; const byte PWM_Pin = 10; const byte Speaker = 12; const int BAT_Pin = A0; int PWM_Value = 0; unsigned long Capacity = 0; int ADC_Value = 0; float BAT_Voltage = 0; byte Hour = 0, Minute = 0, Second = 0; bool calc = false, Done = false; LiquidCrystal lcd(RS, EN, D4, D5, D6, D7); Button UP_Button(16, 25, false, true); Button Down_Button(15, 25, false, true); void setup() { pinMode(PWM_Pin, OUTPUT); pinMode(Speaker, OUTPUT); analogWrite(PWM_Pin, PWM_Value); UP_Button.begin(); Down_Button.begin(); lcd.setCursor(0, 0); lcd.begin(16, 2); lcd.print("Battery Capacity"); lcd.setCursor(0, 1); lcd.print("Measurement v1.0"); delay(3000); lcd.clear(); lcd.print("Load Adj:UP/Down"); lcd.setCursor(0, 1); lcd.print("0"); } void loop() { UP_Button.read(); Down_Button.read(); if (UP_Button.wasReleased() && PWM_Value < 80 && calc == false) { PWM_Value = PWM_Value + 5; analogWrite(PWM_Pin, PWM_Value); lcd.setCursor(0, 1); lcd.print(" "); lcd.setCursor(0, 1); lcd.print(String(Current[PWM_Value / 5]) + "mA"); } if (Down_Button.wasReleased() && PWM_Value > 1 && calc == false) { PWM_Value = PWM_Value - 5; analogWrite(PWM_Pin, PWM_Value); lcd.setCursor(0, 1); lcd.print(" "); lcd.setCursor(0, 1); lcd.print(String(Current[PWM_Value / 5]) + "mA"); } if (UP_Button.pressedFor(1000) && calc == false) { digitalWrite(Speaker, HIGH); delay(100); digitalWrite(Speaker, LOW); lcd.clear(); timerInterrupt(); } } void timerInterrupt() { calc = true; while (Done == false) { Second ++; if (Second == 60) { Second = 0; Minute ++; lcd.clear(); } if (Minute == 60) { Minute = 0; Hour ++; } lcd.setCursor(0, 0); lcd.print(String(Hour) + ":" + String(Minute) + ":" + String(Second)); lcd.setCursor(9, 0); ADC_Value = analogRead(BAT_Pin); BAT_Voltage = ADC_Value * (5.0 / 1024); lcd.print("V:" + String(BAT_Voltage)); lcd.setCursor(0, 1); lcd.print("BAT-C: Wait!..."); if (BAT_Voltage < Low_BAT_level) { lcd.setCursor(0, 1); lcd.print(" "); lcd.setCursor(0, 1); Capacity = (Hour * 3600) + (Minute * 60) + Second; Capacity = (Capacity * Current[PWM_Value / 5]) / 3600; lcd.print("BAT-C:" + String(Capacity) + "mAh"); Done = true; PWM_Value = 0; analogWrite(PWM_Pin, PWM_Value); digitalWrite(Speaker, HIGH); delay(100); digitalWrite(Speaker, LOW); delay(100); digitalWrite(Speaker, HIGH); delay(100); digitalWrite(Speaker, LOW); } delay(1000); } }
Oct 10,2019
5 views
dfasfasgf425134556
gasagasgasg
5
0
0
Published: Oct 10,2019
Purchase
Donation Received ($)
PCBWay Donate 10% cost To Author
Copy this HTML into your page to embed a link to order this shared project
Copy
Under the
Attribution-ShareAlike (CC BY-SA)
License.
Topic
- Comments(0)
- Likes(0)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
It looks like you have not written anything. Please add a comment and try again.
You can upload up to 5 images!
Image size should not exceed 2MB!
File format not supported!
View More
View More
VOTING
0 votes
- 0 USER VOTES
0.00
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Design
1/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Usability
2/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Creativity
3/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Content
4/4
More by popo-fir popo-la
-
audio-cnc-weather-220117 Detail Description~~what's you project about? why did you decide to make it? How does it work? Show ...
-
806-popo-iot-create01 806-popo-iot-create01~~806-popo-iot-create01~~806-popo-iot-create01~~806-popo-iot-create01~~806-popo...
-
806-popo-free -3ge zhuti click-aaa 806-popo-free -3ge zhuti click-aaa~~806-popo-free -3ge zhuti click-aaa~~806-popo-free -3ge zhuti cli...
-
rtrwatt5624525 gdasgasggasdgfgw23424
-
popo-test-3D, xmas 2024 popo-test-3D, xmas 2024 ok~~~popo-test-3D, xmas 2024 ok~~~popo-test-3D, xmas 2024 ok~~~popo-test-3D,...
-
popo-test,NewYear2025 popo-test,NewYear2025 huhui~~~popo-test,NewYear2025 huhui~~~popo-test,NewYear2025 huhui~~~popo-test,...
-
popo-test,2024xmas popo-test,2024xmas lalala~~~
-
popo-kicad-240401~~ what's you project about? why did you decide to make it? How does it work? Show us with images and v...
-
llp 231023 17:57:00 Start building what's you project about? why did you decide to make it? How does it work? Show us with images and v...
-
llp 231023 Start building your project Please input the components of your project. It will help others try to DIY your complete projects.
-
popo 221130 test sdgsdfgfsgh~~~ popo 221130 test 项目内容介绍哈哈哈~~~popo 221130 test 项目内容介绍哈哈哈~~~popo 221130 test 项目内容介绍哈哈哈~~~popo 221130 t...
-
W255755ASH3929_pcb-test what's you project about? why did you decide to make it? How does it work? Show us with images and v...
-
C-H3927W255755A_5.sheet-喷塑1,购物车钣金订单分享项目 what's you project about? why did you decide to make it? How does it work? Show us with images and v...
-
W255755ASH3924_pcb-test 单独分享pcb订单,但是上传了smt且勾选--此项目应该跳转到计价页 hat's you project about? why did you decide to make it? How does it work? Show us with images and vi...
-
W255755ASH3911_share_yellow 通过购物车pcb分享按钮,发布页上传smt相关文件,且勾选 what's you project about? why did you decide to make it? How does it work? Show us with images and v...
-
W255755ASH3911_share_yellow cide to make it? How does it work? Show us with images and videos!(Great project description will ge...
-
W255755ASH3911_share_yellow, share to smt order~~popo PCBWay Assembly capabilities: SMT Assembly, BGA Assembly, Through-Hole Assembly, Mixed Assembly, Rig...
-
C-H3907W255755A_3.sheet-导电氧化30 rewrwerwride to make it? How does it work? Show us with images and videos!(Great project description...
You may also like
-
-
-
-
Enter the title_ of your projectEnter the title_ of your projectEnter the title_ of your projectEnter the title_ of your projectEnter the title_
13 0 0 -
-
-