Skip to content

Instantly share code, notes, and snippets.

@azaharafernandezguizan
Created November 21, 2020 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azaharafernandezguizan/f2b0a7b3854ea2cf54f6a44971550382 to your computer and use it in GitHub Desktop.
Save azaharafernandezguizan/f2b0a7b3854ea2cf54f6a44971550382 to your computer and use it in GitHub Desktop.
int photoSensorDig = 9;
int photoSensorAnalog = 0;
String resultPhotoSensor = "";
void setup()
{
}
void loop()
{
PhotoSensorControl();
delay(500);
}
void PhotoSensorControl()
{
int sensorValue = analogRead(photoSensorAnalog);
float photoVoltage = sensorValue * (5.0 / 1024.0);
resultPhotoSensor = "";
resultPhotoSensor.concat(photoVoltage);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment