The breakout ports are for I2C breakout boards such as BME680 sensor. Unfortunately no drivers modules in MicroPython at the moment.
The distance sensor is not I2C.
The following checks the buttons on Explorer:
# A complete example for using the buttons
# Import a module which will let us wait for a few seconds
import time
#Standard boilerplate code for using the Display Pack
import picoexplorer as display
width = display.get_width()
height = display.get_height()
display_buffer = bytearray(width * height * 2)
display.init(display_buffer)
# And now, lets check each button one-by-one for presses, and print a message if it is pressed
while True: # Continuously loop through this code to check for button presses
if display.is_pressed(0): # Check if the A button is pressed (this is button 0 in the software)
print("Button A is pressed!") # If button A is pressed, print a message saying so!
elif display.is_pressed(1): # Otherwise, check if the B button is pressed (button 1 in the software)
print("Button B is pressed!") # If button B is pressed, print a message saying so!
elif display.is_pressed(2): # Otherwise, check if the X button is pressed (button 2 in the software)
print("Button X is pressed!") # If button X is pressed, print a message saying so!
elif display.is_pressed(3): # Otherwise, check if the Y button is pressed (button 3 in the software)
print("Button Y is pressed!") # If button Y is pressed, print a message saying so!
else: # If none of the buttons are pressed..
print("No buttons are pressed...") # Print a message saying that no buttons are pressed
time.sleep(0.2) # Wait a short time so that the messages don't scroll p
Interestingly I have tested this with 2 Pico’s. One has a captain resetti button soldered on and A doesnt work. The one without the button works fine and detects A input. So strange.
Are you sure you have soldered the Captain Resetti to the correct pins? Although, looking at the pin-outs for both, it would have to be very wrong to affect the A button.
I’ve now daisy-chained a Pico Omnibus to a Pico Explorer so I can use the display and reset without having to do any soldering.
Darn it. I read This breakout is fully compatible with Pimoroni’s breakout garden and assumed it be ok. I am new to all this, should have done some extra reading.
Is that the Sparkfun HC-SR04P sold by Pimoroni? It doesn’t have the Breakout Garden-style connectors, but electrically it uses I2C which is what most of the BG connectors do. You’d either need to wire it manually or use an adapter like this.
Connected it all back up this morning and now I cant get the screen to work. I can see its backlit, not no amount of code will render anything. Button presses are being recognised but that’s about it. Tried flashing both picos, but didn’t help. Really a strange one. Iv run the demo.py as a test in the pico repository and the motors work fine just nothing on the screen anymore.
Did some more testing at lunch. I checked all the GPIO pins on both picos and I can get a connection to light up an LED, so I believe the soldering on the pico’s is fine. I am wondering if I have a damaged board maybe. I have contacted CPC Farnell about getting a replacement.