#define BAT_PIN (A0)
#include <MsTimer2.h>
void hand(); 
void BAT();  // akvizice baterie
int Sample;
float Voltage;

void setup()
{
  // put your setup code here, to run once:
  while(!Serial) {}
  Serial.begin(9600);
  hand();
  MsTimer2::set(100,BAT); // nastavení 100ms vzorkovacího času
  MsTimer2::start();
}

void loop() 
{
}

void BAT() 
{
  Sample = analogRead(BAT_PIN);
  Voltage = Sample*(5.0/1023.0);
  Serial.println(Voltage);
   
} 

void hand() 
{
  
  while(Serial.available() == 0)
  {
    Serial.println("Wait");
    delay(300);
  } 
}
