How can i monitoring the power of my LiPo 3,7V batterie for Arduino MKR1010? What is the best possibility?
Thanks for informations
How can i monitoring the power of my LiPo 3,7V batterie for Arduino MKR1010? What is the best possibility?
Thanks for informations
</>
int analogInput = 0
int f=2
int e=3
int d=4
int c=5
int b=6
int a=7
int s=13
float vout = 0.0
float vin = 0.0
float R1 = 100000
float R2 = 10000
int value = 0
void setup()
{
Serial.begin(9600)
pinMode(analogInput,INPUT)
pinMode(s,OUTPUT)
pinMode(a,OUTPUT)
pinMode(b,OUTPUT)
pinMode(c,OUTPUT)
pinMode(d,OUTPUT)
pinMode(e,OUTPUT)
pinMode(f,OUTPUT)
digitalWrite(s,LOW)
digitalWrite(a,HIGH)
delay(500)
digitalWrite(b,HIGH)
delay(500)
digitalWrite(c,HIGH)
delay(500)
digitalWrite(d,HIGH)
delay(500)
digitalWrite(e,HIGH)
delay(500)
digitalWrite(f,HIGH)
delay(500)
digitalWrite(a,LOW)
digitalWrite(b,LOW)
digitalWrite(c,LOW)
digitalWrite(d,LOW)
digitalWrite(e,LOW)
digitalWrite(f,LOW)
}
void loop()
{
value = analogRead(analogInput)
vout = (value * 5.0) / 1024
vin = vout / (R2/(R1+R2))
Serial.println('Input Voltage = ')
Serial.println(vin)
if(vin>12.46) {digitalWrite(a,HIGH)}
else { digitalWrite(a,LOW)}
if(vin12.28) {digitalWrite(b,HIGH)}
else { digitalWrite(b,LOW)}
if(vin12.12) {digitalWrite(c,HIGH)}
else { digitalWrite(c,LOW)}
if(vin11.98) {digitalWrite(d,HIGH)}
else { digitalWrite(d,LOW)}
if(vin11.90){digitalWrite(e,HIGH)}
else {digitalWrite(e,LOW)}
if(vin<=11.90) {digitalWrite(f,HIGH)}
else {digitalWrite(f,LOW)}
delay(2000)
}
This code will help you a lot in monitoring the battery charge
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use [color = red]code tags[/color] (the </> icon above the compose window) to make it easier to read and copy for examination
actually now i found this tutorial. it is all i need.
thanks a lot for help!
how can I do that
with this </> icon
bla bla
blub
Start by reading the advice in the link that I posted
ok thanks
Everything on one line is stunting.
Nice syntax.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.