"""
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Raspberry Pi Pico SSD1306 OLED Display (MicroPython) ┃
┃ ┃
┃ A program to display Raspberry Pi logo, text, and a ┃
┃ simple timer animation on an SSD1306 OLED display ┃
┃ connected to a Raspberry Pi Pico. ┃
┃ ┃
┃ Copyright (c) 2023 Anderson Costa ┃
┃ GitHub: github.com/arcostasi ┃
┃ License: MIT ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
"""
from machine import Pin, I2C , PWM, ADC
import utime
adc = machine.ADC(28)
Led = PWM(Pin(2))
Led.freq(50)
while True:
# reading analog values from the potentiometer
digital_value = adc.read_u16()
# set duty cycle, range 0-65535
# writing analog values to the LED
Led.duty_u16(digital_value)
print(digital_value)
oled.text(str(digital_value) ,15, 25)
oled.show()
utime.sleep_ms(1000)
if (digital_value > 2222):
c = c+1
print(c)
oled.text(str(c) ,15, 40)
oled.show()