Keyestudio ESP32 Manual page 120

Starter kit
Hide thumbs Also See for ESP32:
Table of Contents

Advertisement

ESP32 Starter Kit
Code
/*
keyestudio ESP32 Inventor Learning Kit
Project 19.2 Dimming Lamp
http://www.keyestudio.com
*/
int
led
=
25;
int
pot
=
34;
void
setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
}
void
loop() {
// put your main code here, to run repeatedly:
int
value
=
analogRead(pot);
int
led_val
=
map(value,0,4095,0,255);
value to the range we need
analogWrite(led,led_val);
}
116
//Define LED to IO25
//Define pot to IO34
//Set LED pin to output
//Convert the range of potentiometer
analog␣
Chapter 8. Arduino Tutorial

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32 and is the answer not in the manual?

Questions and answers

Related Products for Keyestudio ESP32

Table of Contents

Save PDF