So i have a project that I would like to expand, its a small simple program and I would like to be able to read the voltage in the battery to determine how long it will last so I could plan on implementing a possible means of charging.
Board WeMos D1 mini
Windows 10 Pro
Arduino IDE 1.8.13
Here is the code, my problem would be how to read the voltage if A0 is already being used, I know I could simply use a meter to read voltage and I could read ma consumed and do the math but that in it's self would not be what I want to do. This circuit is running on the 3.3v supply and my battery is a mobile bank with 2000ma.
int led=2;
int pir=13;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
pinMode (pir,INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(pir) ==HIGH){
digitalWrite(led,HIGH);
Serial.println("Motion detected");
delay(100);
}
else{
digitalWrite(led,LOW);
Serial.println("Motion stopped");
delay(100);
}
}