import time
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
WIDTH = 128
HEIGHT = 64
i2c = I2C(0)
i2c.scan()
#print('i2c address : '+hex(i2c.scan()[0]).upper())
#print('i2c configuration: '+str(I2C))
Count_num = 1
Situation = 0
while True:
if rp2.bootsel_button() == 1 and Situation == 0: #初めて押された場合
oled = SSD1306_I2C(WIDTH, HEIGHT, i2c)
oled.fill(0)
oled.text('LoadingTEST', 5, 5)
OUT_text = 'STEP_' + str(Count_num)
print(OUT_text)
oled.text(OUT_text, 5, 15)
oled.text('Now Peak', 5, 25)
Count_num += 1
Situation = 1
oled.show()
elif rp2.bootsel_button() == 1 and Situation == 1: #二回目
oled = SSD1306_I2C(WIDTH, HEIGHT, i2c)
oled.fill(0)
oled.text('LoadingTEST', 5, 5)
OUT_text = 'STEP_' + str(Count_num-1) + '--' + str(Count_num)
print(OUT_text)
oled.text(OUT_text, 5, 15)
oled.text('Loading...', 5, 25)
Situation = 0
oled.show()
time.sleep(0.2)