Hack star
Published © MIT

Virtual ESP32 simulator - light sensor interface-2022

Interface a light sensor (photo sensor) to an ESP32 - Micropython - Embedded systems simulator - #Arduino2022 #EmbeddedSystemsSimulator2022

BeginnerProtip1 hour5,448

Things used in this project

Story

Read more

Schematics

ESP32 simulator - Photosensor

Code

ESP32 and photolight sensor code

Python
#include <LiquidCrystal_I2C.h>

#define LDR_PIN 2
LiquidCrystal_I2C lcd(0x27, 20, 4);

void setup() {
  pinMode(LDR_PIN, INPUT);
  lcd.init();
  lcd.backlight();
}

void loop() {
  lcd.setCursor(2, 0);
  lcd.print("Question: ");
  if (digitalRead(LDR_PIN) == LOW) {
    lcd.print("FALSE!");
  } else {
    lcd.print("TRUE! ");
  }
  delay(100);
}

Credits

Hack star
75 projects • 141 followers
an Arduino enthusiast and an electronic hobbyist
Contact

Comments

Please log in or sign up to comment.