stolenpies
December 21, 2023, 00:36

Terminate code mid way through with a button press

Hi all, I have the following code (hopefully this is formatted correctly in discord)
import time
import board
import digitalio
import usb_hid
import sys
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

btn1_pin = (board.GP16)
btn2_pin = (board.GP15)

# Set up the button
btn1 = digitalio.DigitalInOut(btn1_pin)
btn1.direction = digitalio.Direction.INPUT
btn1.pull = digitalio.Pull.DOWN

btn2 = digitalio.DigitalInOut(btn2_pin)
btn2.direction = digitalio.Direction.INPUT
btn2.pull = digitalio.Pull.DOWN

keyboard = Keyboard(usb_hid.devices)

while True:
    if btn1.value:
        keyboard.send(Keycode.A)
        time.sleep(01)
        keyboard.send(Keycode.A)
        time.sleep(01)
        keyboard.send(Keycode.A)
        time.sleep(01)
        keyboard.send(Keycode.A)
        time.sleep(01)
        keyboard.send(Keycode.A)
        time.sleep(01)
        keyboard.send(Keycode.A)
        time.sleep(01)
        keyboard.send(Keycode.A)
        time.sleep(01)
        keyboard.send(Keycode.A)
        time.sleep(01)
        
        
    if btn2.value:
        keyboard.releaseall()
(Eventually the A keycodes will be swapped for scroll down arrow commands to I can scroll up and down a page) What I'm finding impossible to do is to stop the code mid way though with the press of btn2. is there a way to do this? thanks.
timothemagi
December 20, 2023, 18:42

trying to let my 1x8 and 4x8 segement turn fully on

the segements both have some parts on but not all
sparky0280
December 20, 2023, 15:59

15-30 second delayed "Live" Video playback

Hey all, just wondering if this would be possible. I have never used a raspberry pi properly before and have 0 knowledge on them or their capabilities just for a bit of information. I need a way to take a live video feed from a camera or webcam, and play it back with a 15-30 second delay on an external monitor, this would need to be able to run with no internet connection and be robust enough to run for 6 hours per day, 7 days a week, 365 days a year. I'm UK based if that is of any help or hinderance. Thank you all in advance
jbziscool
December 20, 2023, 12:23

Solid red light on pi

Hey all, my pi 4b with ubuntu server 32 bit installed on it has a solid red light on and about 3 minutes ago it was flashing green every 0.5 seconds
bruhskki
December 20, 2023, 00:41

Raspberry Pi camera object detection

i'm trying to setup the camera using a github repository and its not functioning well as a beginner i need help please
goldenrubb3rs
December 19, 2023, 21:53

PiCamera2/Ffmpeg "Thread message queue blocking"

I'm still learning and doing my best to study...
coshi75
December 19, 2023, 20:03

please help me for joystick

guys in the gpio of a rpi 0 w2 WHERE FK is the VRX, VRY and SW
jbziscool
December 19, 2023, 12:54

Wrong password

Hey all, i've been trying to login to my pi (I installed ubuntu server on it), i have an ethernet cable going into it and it seems to only be still red, no green light I have tried sshing into it with username and password ubuntu and it says incorrect Right now I am re flashing it
KUTCHINI
December 19, 2023, 11:23

Rpi-rf 433mhz receiver transmitter

Hello guys, have you ever tried to communicate with the 433mhz receiver and transmitter via raspberrypi 4? It seems that the receiver is not receiving the signals. I tried the same application with Arduino and it actually worked. Any ideas why I can't receive the signals? I use python3 rpi-rf package for this. The wiring between the pi and the transceiver is fine, I doubled check it.
jaxon1710
December 19, 2023, 10:17

Help Code CSGO bomb

an the pins and equipment i just need python code bc i am still figureing out how to code python for this
jaxon1710
December 19, 2023, 02:25

Wrong password when SSH

When i try to ssh i have the right password but it says it is wrong, i am booting of usb without a display with the recommended raspberry pi version, i had have a google and couldnt find anything. is anyone able to help
daeva1405
December 19, 2023, 00:15

Voice Assistant Robot

Hey guys, I am currently building a companion robot for a school competition and am really stumped on how to get started with hardware. I am using a pi 4 model b, and I need the bot to preform voice recognition and face recognition so I was planning on using a USB webcam. I will also need speakers and a display that will serve as the bots face. Do you guys have any suggestions? It will be very similar to the robot Buddy. Thank you so much! https://www.youtube.com/watch?v=Mpakn6WM03Y&t=122s
josephfourier
December 18, 2023, 19:49

GPIO output on RPI5 not working

I've been trying to connect and control an LED on a new raspberry PI 5 using GPIO and a breadboard. I connected the LED with a 220Ω resistor and I'm quite sure it's not burnt, connecting it to a 5V or 3.3V pin lights it up properly. When I try to connect it to a GPIO pin, it's either preset to either high or low and stuck there, no matter what. I tried using the gpiod package on python3, some libraries in rust, and the gpioset command on the command line, using gpioinfo and gpiofind to find the correct pin numbers. I also checked to make sure I have the correct permissions, and ran those with sudo. The LED stays on or off no matter what. In GPIO18 for example it was consistently off, in GPIO21 it was consistently on. I can't fathom what I'm doing wrong.
ziggy00000
December 18, 2023, 04:46

setting up GPS connection

Recently got a pitalk 4g ioT and im trying to use it for its gps capabilities, it takes sim cards for txt and calls aswell as hotspots but im trying to see if i can use it for gps w/ sim card, but if u have recommended sim cards im open to that
airpath144
December 17, 2023, 20:26

HDMI Screen problem

Hi, I got an raspberry pi 400. But ist won‘t Connect to my hdmi Screen. it works with all scenes exept of mine😐. Du you have any idea why it’s not working? Thanks

wolletje01
December 17, 2023, 19:57

No internet

I can not connect to the internet, can not ping my home router, please help ifconfig
end0: flags=4163<UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
inet 192.168.178.192 netmask 255.255.255.0 broadcast 192.168.178.255
inet6 fe80::c3dc::54cb:22f4:6aac prefixlen 64 scopeid 0x20<link>
ether e4:5f:01:db:73:68 txqueuelen 1000 (Ethernet)
SOmething more, but I need to type it and I do not think it is neccesarry
airpath144
December 17, 2023, 14:27

Terminal desnt work

Hi my Terminal dosn‘t works if i want to Start btop++.
juniper000
December 17, 2023, 13:28

ARDUINO IDE LCD 1602 WITH IC2 CODE PROBLEMS

need help with some code
KUTCHINI
December 16, 2023, 22:23

Python

Hello, I have some issues installing python packages I installed pip3-python and then when I type pip3 list I got bunch of errrors. Any help?
nickdevs
December 16, 2023, 21:45

Setting up Home Assistant using M.2 SATA SSD

Hello! I've just purchased my first Pi along with an Argon One case and an M.2 SATA SSD. I'm watching a video on the Home Assistant setup to get a bit of extra knowledge before they arrive and noticed I may be missing a couple of things... I don't have an M.2 SSD to USB adapter to install the Home Assistant OS using the Pi Imager - Will this be required, or can I install the OS on the PI itself? I also didn't purchase an SD card, the video I'm watching uses an SD card to install USB Boot so the OS will boot from the SSD instead of the SD card- Do I need to purchase a good SD card for this, or will the cheapest SD card I can find on Amazon be okay for this step? Thanks 🙂
jelox_
December 16, 2023, 20:26

Chrome and Firefox glitch in remote

Hello, i cant open up firefox or Chrome in my Raspberry. It looks like this . Someone knows why or whtat to do? raspberry pi 4 im Trying it via remotedesktop
richardsimecek
December 16, 2023, 20:05

RPi Pico timer user_data

Hello, i am working with raspberry pi pico and C++ SDK. My goal is to set up timer and have variable increment every 500ms. I read the documentation and there is "user_data" available under the timer struct which id like to use. Im just not sure how can i put data into it and how to access it in the callback function. Thank you
KUTCHINI
December 16, 2023, 19:19

VNC connection refused

Hello guys, I'm trying to setup VNC and connect to PI. It is worth mentioning that I already could connect to PI through VNC. Then I accidentally powered down the PI and since then I could'nt enter conncet again. I downloaded again OS (64-bit, bullseye, with desktop). I connect via SSH to the PI [btw I couldn't connect to the PI with username@hostname, but only with username@ip, I don't know if its relevant] I setup VNC connection in the raspi-config and resolution but cant connect via VNC. Any help would be helpful, Thank you! 🙂
jake12348500
December 16, 2023, 18:18

Mac formatting usb from FAT32 to NTFS

I'm on macbook, how do i format the usb from FAT32 to NTFS?
_gholu
December 16, 2023, 14:41

modify Raspberry pi 400 for iPad

Is there a way to 3d print a keyboard case for raspberry pi 400 to make it like Logitech k480 to use the iPad as screen and there a way to only use the board and use the k480 keyboard only
KUTCHINI
December 16, 2023, 13:10

setting raspberry pi 4

Hello guys, I'm trying to set up a raspberry pi 4. My setup is headless. I don't set up a wireless lan connection. When I connect the lan cable between my laptop and the raspberry pi I try to open ssh with putty, and it couldn't find the host
jelox_
December 16, 2023, 11:44

VNC does not work

Hello, iam new to raspberry and still trying to figure out how it all works. I Wanted to use VNC, to use my raspberry via laptop, but it wont work. Im Using Real VNC viever with my laptop. But if i use "sudo raspi-config" and try to enable VNC, i get the error "Failed to stop wayvnc.service: Unit wayvnc.service not loaded. Failed to enable unit: unit file wayvnc.service does not exist what can i do? do i need to create "wayvnc.service"?
idlehire
December 16, 2023, 08:30

Raspberry Pi 5 Cluster

I'm making a raspberry pi 5 cluster until I realised there is no available rpi 5 cluster cases and I don't have access to work's 3d printer until after christmas. Would a rpi 5 in a rpi 4 open case fit? https://www.amazon.co.uk/Techson-Acrylic-Raspberry-Stackable-Cluster/dp/B07TLSVTQP/
chrisdef.
December 15, 2023, 23:50

Screen Mirroring - Windows Not Duplicating

I've got a Raspberry Pi 4B and two monitors. In the Screen Layout Editor, I have both monitors set to the same resolution and overlaid on top of each other. The mouse, desktop background, and desktop icons are all mirroring properly across both monitors. However, any windows open on my primary monitor (chromium, system settings, etc.) don't show on the secondary monitor unless the window is dragged around with the mouse. If dragging a window, it appears on both monitors. When the dragging stops, the window disappears on the secondary monitor. I've looked through a bunch of forum posts, but no one seems to have this kind of problem. Any advice on how to proceed?
halcyon9333
December 15, 2023, 23:37

I purchased a pi 5 8GB. Looking to go to Arcade 15khz monitor

I know there are several options for previous pi models and the 5 is pretty new. In a few months after I am done with the woodworking on my arcade cabinet, I am looking to use the p5. I am not seeing some of the options for 15khz say they are compabitble with the pi 5. I also would like know what what the best USB encoders might be to get my controls working and coin mechs to register with MAME. Looking for suggestions.