#define PHOTOSENSOR_PIN A0
#define PHOTOSENSOR_DARK 100
#define PHOTOSENSOR_LIGHT 700

void Photosensor_Init(){
  pinMode(PHOTOSENSOR_PIN, INPUT);
}

//Return potentionmetr position in 0-100% 
uint16_t Photosensor_Read(){
  uint16_t value = analogRead(PHOTOSENSOR_PIN);
  value = constrain(value, PHOTOSENSOR_DARK, PHOTOSENSOR_LIGHT);
  value = map(value, PHOTOSENSOR_DARK, PHOTOSENSOR_LIGHT, 0, 100);

  return value;
}