Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
// Dr Paul Lunn - Coventry University
// 9/07/2019
// ESP32 LDR Test
#include <Arduino.h>
const int SERIAL_0_SPEED = 115200;
// The setup() function is called once at the beginning of the program
void setup()
{
Serial.begin(SERIAL_0_SPEED); // begin serial link
Serial.println("ESP32 LDR Test"); // print text onto screen via serial link
}
// The loop() function runs over and over again forever
void loop()
{
int adc_reading = analogRead(36); // use adc to read current value
float light_level = (adc_reading / 4096.0) * 100; //convert adc to light level %
// send results to serial link
Serial.print("ADC reading = ");
Serial.print(adc_reading);
Serial.print(" Light Level = ");
Serial.print(light_level);
Serial.println("%\n");
delay(1000); // wait for a second
}