#1

import time
from machine import SoftI2C,Pin
from pico_i2c_lcd import I2cLcd

i2c = SoftI2C(sda=Pin(26),scl=Pin(21),freq=400000)
lcd = I2cLcd(i2c,i2c.scan()[0],2,16)

to_print = "TESTING FOR LONGER STRING "
to_print = "Hello "

while len(to_print)<16:
    to_print += ' '
    
n = len(to_print)
l = 0
# while 1:
#     if n<16:
#         lcd.move_to(16-n,1)
#         cur_str = to_print[l:n] + to_print[0:l]
#         lcd.putstr(cur_str)
#         l=(l+1)%n
#         time.sleep(0.2)
#     elif l+16<=n:
#         cur_str = to_print[l:l+16]
#         lcd.move_to(0,1)
#         lcd.putstr(cur_str)
#         l+=1
#         time.sleep(0.2)
#     else:
#         cur_str = to_print[l:n] + to_print[0:16-(n-l)]
#         lcd.move_to(0,1)
#         lcd.putstr(cur_str)
#         l=(l+1)%n
#         time.sleep(0.2)


while 1:
    output_str = ""
    temp = l
    for i in range (16):
        output_str += to_print[temp]
        temp = (temp+1)%n
    lcd.move_to(0,1)
    lcd.putstr(output_str)
    time.sleep(0.2)
    l=(l+1)%n

BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT