print("Hello, ESP32!")
from machine import Pin,PWM,ADC
import time
pot_pin=ADC(Pin(34))
LED1=Pin(14,Pin.OUT)
LED2=Pin(33,Pin.OUT)
pwm1=PWM(LED1)
pwm2=PWM(LED2)
while True:
#max 1023
pot_value = pot_pin.read()
pwmOut = int (pot_value/4)
pwm1.duty(pwmOut)
pwm2.duty(0)
time.sleep(1)
pwm1.duty(0)
pwm2.duty(pwmOut)
time.sleep(1)
print('Potentiometer Value = ',pot_value),
print('PWM Value=',pwmOut)
time.sleep_ms(100)
#if 1 cycle 1023 = 2msec
# 24 = ?? msec
# 24 = (2msec/1024) x 24