import time
from machine import Pin, I2C
from utime import sleep, localtime
#https://github.com/easeus-data-recovery-crack
from lcd_i2c import LCD

I2C_ADDR = 0x27     # DEC 39, HEX 0x27
NUM_ROWS = 2
NUM_COLS = 16
ONBOARD_LED = 25

# localtime() returns an 8-part tuplet eg (2024, 11, 1, 0, 0, 1, 5, 1)
def formatted_time():
    Dyear, Dmonth, Dday, Dhour, Dmin, Dsec, Dweekday, Dyearday = localtime()
    fmt = "{:02d}/{:02d}/{} {:02d}:{:02d}"
    return fmt.format(Dday, Dmonth, Dyear, Dhour, Dmin)

def scroll(text):
    n = 16
    lines = [text[i:i+n] for i in range(0, len(text))]
    for line in lines:
        lcd.set_cursor(col=0,row=0)
        lcd.print(line)
        sleep(0.2)
        #for _ in line:
        #    lcd.scroll_display_left()
        #    sleep(0.5)


time.sleep(0.1) # Wait for USB to become ready

# define custom I2C interface, default is 'I2C(0)'
# check the docs of your device for further details and pin infos
i2c = I2C(1, scl=Pin(27), sda=Pin(26), freq=800000)
lcd = LCD(addr=I2C_ADDR, cols=NUM_COLS, rows=NUM_ROWS, i2c=i2c)

lcd.begin()
lcd.print("Hello John-Boy")

print("Hello, Pi Pico!")
print(localtime())
led_red = Pin(13,Pin.OUT)
led_green = Pin(14,Pin.OUT)
led_blue = Pin(15,Pin.OUT)
onboard_led = Pin(ONBOARD_LED, Pin.OUT)

onboard_led.value(1)
sleep(1)
lcd.clear()

while True:
  led_red.value(1)
  lcd.print("Red")
  sleep(1)
  led_red.value(0)
  lcd.clear()
  lcd.print(formatted_time())
  
  sleep(1)
  lcd.clear()
  led_green.value(1)
  lcd.print("Green")
  sleep(1)
  led_green.value(0)
  lcd.clear()
  sleep(1)
  led_blue.value(1)
  lcd.print("Blue")
  sleep(1)
  scroll("Not sure if this will work but we can have a look now")
  lcd.clear()
  led_blue.value(0)
  sleep(1)
# see pinout for which pins go with which IC2 connections (0 or 1)
# https://www.raspberrypi-spy.co.uk/wp-content/uploads/2021/01/raspberry_pi_pico_pinout.png
$abcdeabcde151015202530354045505560fghijfghij
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT