Not yet, I’ll likely get an error and I’d have to change all the “graphics” references to “display”.
I’ll likely give it a go sometime today, was waiting to see if there was an easier way.
Or if how its done just didn’t get documented.
@hel @gadgetoid
import time
import machine
from interstate75 import Interstate75
from interstate75 import Interstate75, SWITCH_A, SWITCH_B
i75 = Interstate75(display=Interstate75.DISPLAY_INTERSTATE75_128X32)
graphics = i75.display
#graphics.set_font("bitmap")
graphics.set_font("bitmap8")
#graphics.set_font("bitmap16")
#graphics.set_font("8x12")
#graphics.set_font("10x14")
t_color = graphics.create_pen(0,0,0)
h_color = graphics.create_pen(0,0,0)
p_color = graphics.create_pen(0,0,0)
black = graphics.create_pen(0,0,0)
red = graphics.create_pen(255,0,0)
green = graphics.create_pen(0,255,0)
blue = graphics.create_pen(0,0,255)
yellow = graphics.create_pen(255,255,0)
orange = graphics.create_pen(255,140,0)
white = graphics.create_pen(255,255,255)
clock = graphics.create_pen(222,222,222)
graphics.set_pen(black)
graphics.clear()
i75.update(graphics)
i75.set_led(0, 0 ,0)
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE
#from breakout_bme280 import BreakoutBME280
from pimoroni_i2c import PimoroniI2C
i2c = PimoroniI2C(sda=(20), scl=(21))
bme = BreakoutBME68X(i2c)
temperature, pressure, humidity, gas, status, _, _ = bme.read()
#bme = BreakoutBME280(i2c, 0x76)
#temperature, pressure, humidity = bme.read()
from breakout_rtc import BreakoutRTC
from machine import RTC
RV3028 = BreakoutRTC(i2c)
rtc = BreakoutRTC(i2c)
if rtc.is_12_hour:
rtc.set_24_hour()
RV3028.update_time()
hour = rtc.get_hours()
minute = rtc.get_minutes()
month = rtc.get_month()
date = rtc.get_date()
if rtc.read_periodic_update_interrupt_flag():
rtc.clear_periodic_update_interrupt_flag()
if rtc.update_time():
rtc_date = rtc.string_date()
rtc_time = rtc.string_time()
#temperature, pressure, humidity = bme.read()
temperature, pressure, humidity, gas, status, _, _ = bme.read()
time.sleep (0.5)
start_time = time.time()
while True:
graphics.set_pen(black)
graphics.clear()
i75.update(graphics)
time_elapsed = time.time() - start_time
RV3028.update_time()
hour = rtc.get_hours()
minute = rtc.get_minutes()
month = rtc.get_month()
date = rtc.get_date()
if rtc.read_periodic_update_interrupt_flag():
rtc.clear_periodic_update_interrupt_flag()
if rtc.update_time():
rtc_date = rtc.string_date()
rtc_time = rtc.string_time()
#year, month, day, wd, hour, minute, second, _ = rtc.datetime()
graphics.set_pen(clock)
if hour == 0:
graphics.text(f"{12}:{minute:02}AM", 1, 1, scale=2)
elif 0 <= hour < 10:
graphics.text(f"{hour:1}:{minute:02}AM", 7, 1, scale=2)
elif 10 <= hour < 12:
graphics.text(f"{hour:2}:{minute:02}AM", 1, 1, scale=2)
elif hour == 12:
graphics.text(f"{hour:2}:{minute:02}PM", 1, 1, scale=2)
elif hour > 12:
hour = hour - 12
if hour < 10:
graphics.text(f"{hour:1}:{minute:02}PM", 7, 1, scale=2)
elif 10 <= hour < 12:
graphics.text(f"{hour:2}:{minute:02}PM", 1, 1, scale=2)
elif hour == 12:
graphics.text(f"{hour:2}:{minute:02}AM", 1, 1, scale=2)
#temperature, pressure, humidity = bme.read()
temperature, pressure, humidity, gas, status, _, _ = bme.read()
temperature = round(temperature)
if temperature < -10:
t_color = white
elif -10 <= temperature <= 0:
t_color = blue
elif 0 < temperature <= 12:
t_color = yellow
elif 12 < temperature <= 16:
t_color = green
elif 16 < temperature <= 24:
t_color = green
elif 24 < temperature <= 27:
t_color = orange
elif temperature > 27:
t_color = red
graphics.set_pen(t_color)
if temperature > 0:
graphics.text("+{:0.0f}°C" .format(temperature), 10, 17, scale=2)
else:
graphics.text("{:0.0f}°C" .format(temperature), 15, 17, scale=2)
humidity = round(humidity)
if humidity < 30:
h_color = red
elif 30 <= humidity <= 60:
h_color = green
elif 60 < humidity < 80:
h_color = yellow
elif humidity >= 80:
h_color = orange
graphics.set_pen(h_color)
graphics.text("{:0.0f}% RH".format(humidity), 69, 1, scale=2)
pressuremb = pressure / 100
pressuremb = round(pressuremb)
if pressuremb < 982:
p_color = red
elif 982 <= pressuremb < 1004:
p_color = yellow
elif 1004 <= pressuremb < 1026:
p_color = green
elif 1026 <= pressuremb < 1048:
p_color = blue
elif pressuremb >= 1048:
p_color = orange
graphics.set_pen(p_color)
graphics.text("{:0.0f}mb" .format(pressuremb), 67, 17, scale=2)
i75.update(graphics)
time.sleep (30)