"""
from machine import Pin
from utime import sleep
print("Hello, ESP32!")
led = Pin(18, Pin.OUT)
while True:
led.on()
sleep(0.5)
led.off()
sleep(0.5)
"""
""
from machine import Pin,ADC
from time import sleep
from machine import Pin, PWM
pot = ADC(Pin(34))
pot.atten(ADC.ATTN_11DB)
pot.width(ADC.WIDTH_10BIT)
led_pin=Pin(18,Pin.OUT)
led_pwm=PWM(led_pin)
while True:
pot_value=pot.read()
duty_cycle = pot_value
led_pwm.duty(duty_cycle)
print(pot_value)
sleep(0.1)
"""
from machine import Pin, ADC
from time import sleep
from machine import Pin, PWM
pot = ADC(Pin(34))
pot.atten(ADC.ATTN_11DB)
pot.width(ADC.WIDTH_10BIT)
led_pin=Pin(18,Pin.OUT)
led_pwm=PWM(led_pin)
while True:
pot_value = pot.read()
duty_cycle = pot_value
led_pwm.duty(duty_cycle)
print(pot_value)
sleep(0.1)