raspberry-pi-zero

How to send real-time sensor data to PC from Raspberry Pi Zero?

笑着哭i 提交于 2021-01-28 01:51:39
问题 I've written a Python3 script which runs on Raspberry Pi Zero W that collects data from an IMU sensor (MPU9250) and creates 3 different angle values; roll, pitch, yaw. Which looks like this: def main(): while True: dataAcc = mpu.readAccelerometerMaster() dataGyro = mpu.readGyroscopeMaster() dataMag = mpu.readMagnetometerMaster() [ax, ay, az] = [round(dataAcc[0], 5), round(dataAcc[1], 5), round(dataAcc[2], 5)] [gx, gy, gz] = [round(dataGyro[0], 5), round(dataGyro[1], 5), round(dataGyro[2], 5)]

Unable to control raspberry pi camera remotely using MQTT

谁说我不能喝 提交于 2020-03-06 11:06:29
问题 I am trying to start and stop the recording of camera attached to a Raspberry Pi Zero W (client) using MQTT. Below is the specific part of the code which I am trying to use to achieve this: continueRecording = 1 def shopRecording(): global shop_record_flag_start, camera, continueRecording print("Starting Recording") while 1: print(shop_record_flag_start) with picamera.PiCamera() as camera: camera.resolution = (640, 480) camera.framerate = 20 camera.start_recording("/home/pi/camera-recording

PiZero W connected to two peripherals (GPIO and USB): how to continuously read from both at same time?

独自空忆成欢 提交于 2020-01-20 08:33:05
问题 I have a raspberry pizero W that is connected via GPIO pins to a flowmeter and USB to a barcode scanner. I have python script that uses a callback function to be alerted when the GPIO input is sensed. This python script needs to be continuously running on the pizero in order to recognize when the flowmeter is activated and process the input. The problem is that I also have a barcode scanner attached via USB to the pizero. I would like the pizero to also recognize when a barcode is scanned and