from machine import I2C, Pin
from i2c_lcd import I2cLcd
from utime import sleep
import time
import random
DEFAULT_I2C_ADDR = 0x27 # LCD 1602 I2C address
i2c = I2C(0,sda=Pin(0),scl=Pin(1),freq=400000)
lcd = I2cLcd(i2c, DEFAULT_I2C_ADDR,2, 26) # Initialize(device address, backlight settings)
item = {0: 'Pokemon Red', 1: 'Octopus [OC-22]', 2: 'Pokemon Blue', 3: 'Donkey Kong [DK-52]', 4: 'Final Fantasy Origins', 5: 'Platinum Gameboy Advance SP', 6: 'Pokemon Green', 7: 'GBA Micro [20th Anniversary Edition]', 8: 'Super Mario Bros. [35th Anniversary]', 9: 'Pokemon Crystal', 10: 'Pokemon Silver', 11: 'Snoopy Tennis [SP-30]', 12: 'Red Dreamcast VMU', 13: 'Pokemon Gold', 14: 'Vib-ribbon', 15: 'PocketStation', 16: 'Gameboy System [Clear Play It Loud]', 17: 'Pocket Pikachu Console', 18: 'Pokewalker', 19: 'Pokemon Yellow', 20: 'Pokemon Blue', 21: 'Kurushi', 22: 'Mario Artist: Polygon Studio [DD]', 23: 'Parachute [PR-21]', 24: 'Game Boy Color Atomic Purple', 25: 'Legend of Zelda', 26: 'Randnet [DD]', 27: 'No One Can Stop Mr. Domino', 28: 'Pokemon Sapphire', 29: 'Mario Bros. [MW-56]'}
price = {0: 6200, 1: 10906, 2: 2551, 3: 8500, 4: 4862, 5: 14524, 6: 7450, 7: 21650, 8: 2708, 9: 9327, 10: 5321, 11: 20167, 12: 3600, 13: 4673, 14: 4699, 15: 3062, 16: 7377, 17: 14039, 18: 5200, 19: 8363, 20: 8811, 21: 3411, 22: 11998, 23: 22593, 24: 6653, 25: 4085, 26: 10018, 27: 6029, 28: 7090, 29: 9799}
if __name__ == '__main__':
while True:
length = len(item[5])
text_lst = list(item[5])
first_letter = 0
last_letter = 16
mod_length = length - last_letter
if length <= last_letter:
lcd.move_to(0,0)
lcd.putstr(item[0])
else:
for i in range(0, length):
if first_letter <= mod_length:
print(first_letter)
print(mod_length)
lcd.move_to(0,0)
lcd.putstr(text_lst[first_letter:last_letter])
sleep(0.2)
first_letter = first_letter + 1
last_letter = last_letter + 1
else:
sleep(1)
print("got to here")
break