Skip to content

Instantly share code, notes, and snippets.

@PaulskPt
Last active April 16, 2024 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulskPt/ad9e39cdcb9aefc392f02be2fc83fd62 to your computer and use it in GitHub Desktop.
Save PaulskPt/ad9e39cdcb9aefc392f02be2fc83fd62 to your computer and use it in GitHub Desktop.
_Raspberry Pi 5B-8GB with GamepadQT and AHT20
# SPDX-FileCopyrightText: 2024 Paulus @PaulskPt on Github
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-FileCopyrightText: 2023 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This is a Python script to test:
A Raspberry Pi 5B-8GB single board computer with, via I2C, connected:
a) an Adafruit Mini I2C Gamepad with seesaw - STEMMA QT / Qwiic (https://www.adafruit.com/product/5743);
b) an Adafruit AHT20 Temperatur & Humidity Sensor Breakout Board - STEMMA QT / Qwiic (https://www.adafruit.com/product/4566).
Added functionality to save data to two separate log files:
1) gamepadqt.log for some system info and data from the Gamepad QT;
2) aht20.log for some system info and data from the AHT20 sensor.
This script has been successfully tested on a Raspberry Pi 5B-8GB
within a virtual enviroment (env) from within an own project directory (/home/<user>/projects/rpi5_tmp_hum/).
This script needs the Adafruit-Blinka repo to be installed on to Raspberry Pi 5B-8GB.
It also uses the Adafruit-Python-extended-Bus repo to make I2C communication possible.
The following lines need to be present in the file: /boot/firmware/config.txt:
dtparam=i2c_arm=on
dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=17,i2c_gpio_scl=27
Want more? See my repos on Github.com/PaulskPt and my gists on Github.com/Gist/PaulskPt.
"""
import time as _time
from datetime import datetime
import os
import sys
import gc
import board
from micropython import const
from lib.adafruit_ahtx0 import AHTx0
from adafruit_seesaw.seesaw import Seesaw
from adafruit_extended_bus import ExtendedI2C as I2C
import microcontroller
import logging as logging # see: https://docs.python.org/3/howto/logging-cookbook.html#logging-cookbook
import tomllib # see: https://docs.python.org/3/library/tomllib.html
with open("settings.toml", "rb") as f:
data = tomllib.load(f)
if f:
f.close()
del f
class State:
def __init__(self, saved_state_json=None):
self.board_id = None
self.USE_TAG = None
self.my_debug = False
self.seesaw = None
self.tempSensor = None
self.msg1_shown = False
self.last_x = 0
self.last_y = 0
self.qt_btns_present = False
self.aht20_present = False
self.LOG_QT = None
self.LOG_AHT = None
self.temperature_old = None
self.humidity_old = None
self.get_INT_RTC = True
self.SYS_RTC_is_set = False
self.RTCtpl = None
self.RTCtpl_DOW = DOW = \
{
0: "Monday",
1: "Tuesday",
2: "Wednesday",
3: "Thursday",
4: "Friday",
5: "Saturday",
6: "Sunday"
}
self.RTCtpl_MONTH = \
{
0: "Dummy",
1: "January",
2: "February",
3: "March",
4: "April",
5: "May",
6: "June",
7: "July",
8: "August",
9: "September",
10: "October",
11: "November",
12: "December"
}
self.BUTTON_X = const(6)
self.BUTTON_Y = const(2)
self.BUTTON_A = const(5)
self.BUTTON_B = const(1)
self.BUTTON_SELECT = const(0)
self.BUTTON_START = const(16)
self.button_mask = const(
(1 << self.BUTTON_X)
| (1 << self.BUTTON_Y)
| (1 << self.BUTTON_A)
| (1 << self.BUTTON_B)
| (1 << self.BUTTON_SELECT)
| (1 << self.BUTTON_START)
)
state = State()
state.my_debug = True if int(data["MY_DEBUG"]) else False
state.USE_TAG = True if int(data["USE_TAG"]) else False
state.LOG_QT = True if int(data["LOG_QT"]) else False
state.LOG_AHT = True if int(data["LOG_AHT"]) else False
del data
logfile_qt = 'gamepadqt.log'
logfile_aht = 'aht20.log'
logging_level = logging.DEBUG
logger_qt = logging.getLogger('RPi5_gamepadqt_test') # .addHandler(logging.NullHandler())
logger_aht = logging.getLogger('RPi5_aht20_test') # .addHandler(logging.NullHandler())
logger_qt.setLevel(logging_level)
logger_aht.setLevel(logging_level)
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
formatter = logging.Formatter(format, datefmt="%Y-%m-%d %H:%M:%S")
file_handler_qt = logging.FileHandler(logfile_qt)
file_handler_qt.setFormatter(formatter)
file_handler_aht = logging.FileHandler(logfile_aht)
file_handler_aht.setFormatter(formatter)
#console = logging.StreamHandler()
#console.setFormatter(formatter)
if state.LOG_QT:
logger_qt.addHandler(file_handler_qt)
else:
logger_qt.addHandler(logging.NullHandler()) # Don't log
#logger_qt.addHandler(console)
if state.LOG_AHT:
logger_aht.addHandler(file_handler_aht)
else:
logger_aht.addHandler(logging.NullHandler()) # Don't log
#logger_aht.addHandler(console)
del logfile_qt
del logfile_aht
del logging_level
del format
del formatter
del file_handler_qt
del file_handler_aht
def get_dt():
now = datetime.now()
dt = now.timetuple()
dt1 = "{:s}, {:s} {:02d}, {:02d},".format(state.RTCtpl_DOW[dt.tm_wday], state.RTCtpl_MONTH[dt.tm_mon], dt.tm_mday, dt.tm_year)
if dt.tm_hour < 12:
hh = dt.tm_hour
ampm = "am"
elif dt.tm_hour == 12:
hh = dt.tm_hr
ampm = "pm"
elif dt.tm_hour >= 13:
hh = dt.tm_hour - 12
ampm = "pm"
dt2 = "at: {:02d}:{:02d}:{:02d} {:s} ".format(hh, dt.tm_min, dt.tm_sec, ampm )
return dt1+" "+dt2
line = "-" * 55
print(line)
logger_qt.info(line)
logger_aht.info(line)
s = "New run:"
print(s)
logger_qt.info(s)
logger_aht.info(s)
s = f"from python script: \"{sys.argv[0]}\"" # __file__ includes the full path to the file
print(s)
logger_qt.info(s)
logger_aht.info(s)
s = "Runtime: "+get_dt()
print(s)
logger_qt.info(s)
logger_aht.info(s)
print(line)
logger_qt.info(line)
logger_aht.info(line)
del line
state.board_id = board.board_id
logger_qt.info(f"board id: {state.board_id}")
logger_aht.info(f"board id: {state.board_id}")
s= "using Adafruit_Python_extended_Bus. Using I2C bus #3" # github.com/adafruit/Adafruit_Python_extended_Bus
logger_qt.info(s)
logger_aht.info(s)
del s
i2c_bus = I2C(3) # I2C bus to be used: /dev/i2c-3
if i2c_bus is None:
s = f"Error: type(i2c_bus)= {type(i2c_bus)}. Exiting..."
logger_qt.error(s)
logger_aht.error(s)
sys.exit()
e = None
try:
seesaw = Seesaw(i2c_bus, addr=0x50)
seesaw.pin_mode_bulk(state.button_mask, seesaw.INPUT_PULLUP)
if state.my_debug:
print(f"global(): type(seesaw) = {type(seesaw)}")
if seesaw:
state.seesaw = seesaw
state.qt_btns_present = True
del seesaw
except Exception as e:
logger_qt.error(f"global(): Error while creating an instance seesaw class: {e}")
state.qt_btns_present = False
pass
try:
# tempSensor = PiicoDev_TMP117() # initialise the sensor
tempSensor = AHTx0(i2c_bus) # initialise the sensor
#logger_aht.info(f"type(tempSensor)= {type(tempSensor)}")
if tempSensor:
state.tempSensor = tempSensor
state.aht20_present = True
del tempSensor
except Exception as e:
logger_aht.error(f"global(): Error while creating an instance ath20 sensor class: {e}")
state.aht20_present = False
pass
del e
del i2c_bus
s = "Gamepad QT is {} present".format("" if state.qt_btns_present else " not")
logger_qt.info(s)
s = "AHT20 sensor is {} present".format("" if state.aht20_present else " not")
logger_aht.info(s)
del s
gc.collect()
def test_msg(state):
TAG = "gamepad_test(): "
s1 = s2 = ""
if state.qt_btns_present:
s1 = "the Gamepad QT"
if state.aht20_present:
s2 = "and the AHT20 sensor"
if not state.msg1_shown:
if not state.qt_btns_present and not state.aht20_present:
s = TAG+f"neither of the Gamepad QT or the AHT20 sensor is present. Check wiring. Exiting..."
print(s)
logger_qt.error(s)
logger_aht.error(s)
# _time.sleep(3)
sys.exit()
elif state.qt_btns_present or state.aht20_present:
state.msg1_shown = True
print(TAG+f"We\'re going to test {s1} {s2} with this {state.board_id}.")
if state.qt_btns_present:
print("\t\tPress any of the buttons (X, Y, A, B, Select or Start) on the Gamepad QT.\n\t\t" + \
f"To reboot {state.board_id} press Gamepad QT button Start.\n")
def ck_usr_answr():
ret = False
ays = "Are you sure? (Y/n)+<Enter>: "
answer = ""
while True:
logger_qt.warning(ays)
logger_aht.warning(ays)
answer = input(ays)
s = f"You answered: \'{answer}\'"
print(s)
logger_qt.info(s)
logger_aht.info(s)
if answer.upper() == "Y":
ret = True
break
elif answer.upper() == "N":
s = "not rebooting"
logger_qt.info(s)
logger_aht.info(s)
break
return ret
def reboot():
s = "\nRebooting..."
print(s)
logger_qt.info(s)
logger_aht.info(s)
_time.sleep(3)
os.system("sudo reboot") # for Raspberry Pi boards
#microcontroller.reset() # for CircuitPython boards
def pr_btn_name(res):
btns = ["X", "Y", "A", "B", "Select", "Start"]
if res >= 0 and res < len(btns):
#blink_led(state)
s = "Button "+btns[res]+" pressed"
print(s)
logger_qt.info(s)
# Check for button presses on the Gamepad QT
def ck_qt_btns(state):
TAG = "ck_qt_btns(): "
if not state.qt_btns_present:
print(TAG+f"state.qt_btns_present= {state.qt_btns_present}")
return
nr_btns = 6
res_x = res_y = res_a = res_b = res_sel = res_sta = -1
elapsed_t = None
interval_t = 36
interval_cnt = 0
gc.collect()
_time.sleep(0.2)
try:
# get the joystick x and y axis value
x = 1023 - state.seesaw.analog_read(14)
y = 1023 - state.seesaw.analog_read(15)
except Exception as e:
if e.errno == 121: # Remote I/O Error
logger_qt.error(f"Error: {e}")
pass
if x >= state.last_x:
diff_x = abs(x - state.last_x)
else:
diff_x = abs(state.last_x - x)
if y >= state.last_y:
diff_y = abs(y - state.last_y)
else:
diff_y = abs(state.last_y - y)
if (diff_x > 3) or (diff_y > 3):
s = f"joystick: (x, y)= ({x}, {y})"
print(s)
logger_qt.info(s)
# print(TAG+f"diff_x= {diff_x}, diff_y= {diff_y}")
state.last_x = x
state.last_y = y
# Get the button presses, if any...
buttons = state.seesaw.digital_read_bulk(state.button_mask)
if state.my_debug:
s = "\n"+TAG+f"buttons = {buttons}"
print(s)
logger_qt.info(s)
if buttons == 65639:
if state.my_debug:
logger_qt.info(TAG+f"Gamepad QT: no button pressed")
return
# _time.sleep(0.5)
start_t = _time.monotonic()
if buttons:
res = -1
for _ in range(nr_btns):
if _ == 0:
bz = 1 << state.BUTTON_X
if not buttons & (bz):
res = _
if res_x != res:
pr_btn_name(res)
res_x = res
break
if _ == 1:
bz = 1 << state.BUTTON_Y
if not buttons & (bz):
res = _
if res_y != res:
pr_btn_name(res)
res_y = res
break
if _ == 2:
bz = 1 << state.BUTTON_A
if not buttons & (bz):
res = _
if res_a != res:
pr_btn_name(res)
res_a = res
break
if _ == 3:
bz = 1 << state.BUTTON_B
if not buttons & (bz):
res = _
if res_b != res:
pr_btn_name(res)
res_b = res
break
if _ == 4:
bz = 1 << state.BUTTON_SELECT
if not buttons & (bz):
res = _
if res_sel != res:
pr_btn_name(res)
res_sel = res
break
if _ == 5:
bz = 1 << state.BUTTON_START
if not buttons & (bz):
res = _
if res_sta != res:
pr_btn_name(res)
res_sta = res
s = f"About to reboot the {state.board_id}"
logger_qt.info(s)
logger_aht.info(s)
if ck_usr_answr():
reboot() # Reboot the board
else:
state.msg1_shown = False
res_sta = -2
test_msg(state)
break
curr_t = _time.monotonic()
elapsed_t = (curr_t - start_t) * 1000
if elapsed_t >= interval_t:
interval_cnt += 1
if interval_cnt >= 100:
interval_cnt = 0
res_x = res_y = res_a = res_b = res_sel = res_sta = -2
start_t = curr_t
_time.sleep(0.01)
def ck_temphum(state):
if not state.aht20_present:
return
tmp = state.tempSensor.temperature # Celsius
hum = state.tempSensor.relative_humidity #
# Convert temperature and humidity values into a string and print the data
t = "temperature: {:5.2f} °C".format(tmp)
h = "humidity: {:5.2f} %".format(hum)
if state.temperature_old is None:
state.temperature_old = 0.00
if state.humidity_old is None:
state.humidity_old = 0.00
if t != state.temperature_old:
state.temperature_old = t
if h != state.humidity_old:
state.humidity_old = t
try:
print(t)
logger_aht.info(t)
print(h)
logger_aht.info(h)
except Exception as e:
logger_aht.exception(f"Error: {e}")
def get_dt():
now = datetime.now()
dt = now.timetuple()
dt1 = "{:d}/{:02d}/{:02d}".format(dt.tm_mon, dt.tm_mday, dt.tm_year)
dt2 = "{:02d}:{:02d}:{:02d} weekday: {:s}".format(dt.tm_hour, dt.tm_min, dt.tm_sec, state.RTCtpl_DOW[dt.tm_wday])
return dt1+" "+dt2
def get_INT_RTC(state):
if not state.get_INT_RTC:
return
TAG = "get_INT_RTC(): "
dt = None
now = None
try:
now = datetime.now()
state.RTCtpl = now.timetuple()
except OSError as e:
logger_qt.error(TAG+f"Error: {e}")
raise
except Exception as e:
raise
if state.RTCtpl is not None:
if state.my_debug:
logger_aht.info(f"type(state.RTCtpl) = {type(state.RTCtpl)}")
if state.my_debug:
logger_qt.info(TAG+f"state.RTCtpl: {state.RTCtpl}")
logger_aht.info(TAG+f"state.RTCtpl: {state.RTCtpl}")
state.SYS_RTC_is_set = True
dt = state.RTCtpl
# print(TAG+f"dt= {dt}")
dt1 =TAG+"{:d}/{:02d}/{:02d}".format(dt.tm_mon, dt.tm_mday, dt.tm_year)
dt2 = TAG+"{:02d}:{:02d}:{:02d} weekday: {:s}".format(dt.tm_hour, dt.tm_min, dt.tm_sec, state.RTCtpl_DOW[dt.tm_wday])
logger_qt.info(dt1)
logger_aht.info(dt1)
logger_qt.info(dt2)
logger_aht.info(dt2)
def setup(state):
TAG = "setup(): "
if state.get_INT_RTC :
if state.my_debug:
logger_aht.info(TAG+"Going to get datetime from internal (SYS) RTC")
get_INT_RTC(state)
gc.collect()
def main():
TAG= "main(): "
loopnr = 0
setup(state)
test_msg(state)
s = "\n\nAdafruit Gamepad QT test:\n"
logger_qt.info(s)
s = "\n\nAdafruit AHT20 test:\n"
logger_aht.info(s)
if state.aht20_present:
logger_aht.info('logged values of temperature and humidity from Adafruit AHT20 sensor:')
while True:
try:
loopnr += 1
# print(f"\nLoopnr: {loopnr}")
if loopnr >= 100:
loopnr = 0
ck_qt_btns(state)
_time.sleep(0.5)
ck_temphum(state)
except KeyboardInterrupt:
s = TAG+"KeyboardInterrrupt. Exiting..."
print(s)
logger_qt.info(s)
logger_aht.info(s)
break
if loopnr >= 1000:
break
sys.exit()
if __name__ == '__main__':
main()
MY_DEBUG = "0"
USE_TAG = "1"
LOG_QT = "1" # Send GamepadQT data to gamepadqt.log
LOG_AHT = "1" # Send AHT20 data to aht20.log
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - -------------------------------------------------------
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - New run:
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - from python script: "gamepadqt_and_aht20.py"
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - Runtime: Tuesday, April 16, 2024, at: 10:21:39 pm
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - -------------------------------------------------------
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - board id: RASPBERRY_PI_5
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - using Adafruit_Python_extended_Bus. Using I2C bus #3
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - AHT20 sensor is present
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - get_INT_RTC(): 4/16/2024
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - get_INT_RTC(): 22:21:39 weekday: Tuesday
2024-04-16 22:21:39 - RPi5_aht20_test - INFO -
Adafruit AHT20 test:
2024-04-16 22:21:39 - RPi5_aht20_test - INFO - logged values of temperature and humidity from Adafruit AHT20 sensor:
2024-04-16 22:21:40 - RPi5_aht20_test - INFO - temperature: 25.64 °C
2024-04-16 22:21:40 - RPi5_aht20_test - INFO - humidity: 47.81 %
2024-04-16 22:21:41 - RPi5_aht20_test - INFO - temperature: 25.64 °C
2024-04-16 22:21:41 - RPi5_aht20_test - INFO - humidity: 47.95 %
2024-04-16 22:21:42 - RPi5_aht20_test - INFO - temperature: 25.65 °C
2024-04-16 22:21:42 - RPi5_aht20_test - INFO - humidity: 48.01 %
2024-04-16 22:21:42 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:42 - RPi5_aht20_test - INFO - humidity: 48.03 %
2024-04-16 22:21:43 - RPi5_aht20_test - INFO - temperature: 25.67 °C
2024-04-16 22:21:43 - RPi5_aht20_test - INFO - humidity: 47.98 %
2024-04-16 22:21:44 - RPi5_aht20_test - INFO - temperature: 25.67 °C
2024-04-16 22:21:44 - RPi5_aht20_test - INFO - humidity: 47.92 %
2024-04-16 22:21:45 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:45 - RPi5_aht20_test - INFO - humidity: 47.91 %
2024-04-16 22:21:46 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:46 - RPi5_aht20_test - INFO - humidity: 47.82 %
2024-04-16 22:21:46 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:46 - RPi5_aht20_test - INFO - humidity: 47.73 %
2024-04-16 22:21:47 - RPi5_aht20_test - INFO - temperature: 25.67 °C
2024-04-16 22:21:47 - RPi5_aht20_test - INFO - humidity: 47.60 %
2024-04-16 22:21:48 - RPi5_aht20_test - INFO - temperature: 25.68 °C
2024-04-16 22:21:48 - RPi5_aht20_test - INFO - humidity: 47.50 %
2024-04-16 22:21:49 - RPi5_aht20_test - INFO - temperature: 25.64 °C
2024-04-16 22:21:49 - RPi5_aht20_test - INFO - humidity: 47.45 %
2024-04-16 22:21:50 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:50 - RPi5_aht20_test - INFO - humidity: 47.57 %
2024-04-16 22:21:51 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:51 - RPi5_aht20_test - INFO - humidity: 47.67 %
2024-04-16 22:21:51 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:51 - RPi5_aht20_test - INFO - humidity: 47.66 %
2024-04-16 22:21:52 - RPi5_aht20_test - INFO - temperature: 25.67 °C
2024-04-16 22:21:52 - RPi5_aht20_test - INFO - humidity: 47.45 %
2024-04-16 22:21:53 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:53 - RPi5_aht20_test - INFO - humidity: 47.35 %
2024-04-16 22:21:54 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:54 - RPi5_aht20_test - INFO - humidity: 47.12 %
2024-04-16 22:21:55 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:55 - RPi5_aht20_test - INFO - humidity: 46.93 %
2024-04-16 22:21:55 - RPi5_aht20_test - INFO - temperature: 25.68 °C
2024-04-16 22:21:55 - RPi5_aht20_test - INFO - humidity: 46.85 %
2024-04-16 22:21:56 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:21:56 - RPi5_aht20_test - INFO - humidity: 46.95 %
2024-04-16 22:21:57 - RPi5_aht20_test - INFO - temperature: 25.68 °C
2024-04-16 22:21:57 - RPi5_aht20_test - INFO - humidity: 46.93 %
2024-04-16 22:21:58 - RPi5_aht20_test - INFO - temperature: 25.67 °C
2024-04-16 22:21:58 - RPi5_aht20_test - INFO - humidity: 46.86 %
2024-04-16 22:21:58 - RPi5_aht20_test - INFO - About to reboot the RASPBERRY_PI_5
2024-04-16 22:21:58 - RPi5_aht20_test - WARNING - Are you sure? (Y/n)+<Enter>:
2024-04-16 22:22:01 - RPi5_aht20_test - INFO - You answered: 'n'
2024-04-16 22:22:01 - RPi5_aht20_test - INFO - not rebooting
2024-04-16 22:22:01 - RPi5_aht20_test - INFO - temperature: 25.64 °C
2024-04-16 22:22:01 - RPi5_aht20_test - INFO - humidity: 46.63 %
2024-04-16 22:22:02 - RPi5_aht20_test - INFO - temperature: 25.66 °C
2024-04-16 22:22:02 - RPi5_aht20_test - INFO - humidity: 46.55 %
2024-04-16 22:22:03 - RPi5_aht20_test - INFO - temperature: 25.67 °C
2024-04-16 22:22:03 - RPi5_aht20_test - INFO - humidity: 46.59 %
2024-04-16 22:22:04 - RPi5_aht20_test - INFO - temperature: 25.68 °C
2024-04-16 22:22:04 - RPi5_aht20_test - INFO - humidity: 46.54 %
2024-04-16 22:22:04 - RPi5_aht20_test - INFO - main(): KeyboardInterrrupt. Exiting...
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - -------------------------------------------------------
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - New run:
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - from python script: "gamepadqt_and_aht20.py"
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - Runtime: Tuesday, April 16, 2024, at: 10:21:39 pm
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - -------------------------------------------------------
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - board id: RASPBERRY_PI_5
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - using Adafruit_Python_extended_Bus. Using I2C bus #3
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - Gamepad QT is present
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - get_INT_RTC(): 4/16/2024
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - get_INT_RTC(): 22:21:39 weekday: Tuesday
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO -
Adafruit Gamepad QT test:
2024-04-16 22:21:39 - RPi5_gamepadqt_test - INFO - joystick: (x, y)= (504, 511)
2024-04-16 22:21:46 - RPi5_gamepadqt_test - INFO - Button A pressed
2024-04-16 22:21:51 - RPi5_gamepadqt_test - INFO - Button B pressed
2024-04-16 22:21:52 - RPi5_gamepadqt_test - INFO - Button X pressed
2024-04-16 22:21:53 - RPi5_gamepadqt_test - INFO - Button Y pressed
2024-04-16 22:21:56 - RPi5_gamepadqt_test - INFO - Button Select pressed
2024-04-16 22:21:58 - RPi5_gamepadqt_test - INFO - Button Start pressed
2024-04-16 22:21:58 - RPi5_gamepadqt_test - INFO - About to reboot the RASPBERRY_PI_5
2024-04-16 22:21:58 - RPi5_gamepadqt_test - WARNING - Are you sure? (Y/n)+<Enter>:
2024-04-16 22:22:01 - RPi5_gamepadqt_test - INFO - You answered: 'n'
2024-04-16 22:22:01 - RPi5_gamepadqt_test - INFO - not rebooting
2024-04-16 22:22:02 - RPi5_gamepadqt_test - INFO - joystick: (x, y)= (504, 832)
2024-04-16 22:22:03 - RPi5_gamepadqt_test - INFO - joystick: (x, y)= (504, 511)
2024-04-16 22:22:04 - RPi5_gamepadqt_test - INFO - main(): KeyboardInterrrupt. Exiting...
@PaulskPt
Copy link
Author

PaulskPt commented Apr 15, 2024

Images: I2C wiring

Python modules present within this project's virtual environment modules

Images from the contents of the logs and screenshots of the console output in cases when either the GamepadQT, the AHT20 sensor or both were not connected. error messages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment