i have been trying to interface the rc522 rfid module but i cant seem to make it work. can someone help?
I am using this tutorial: https://pimylifeup.com/raspberry-pi-rfid-rc522/
I have enables SPI
None of my GPIOs are fried, i have checked them using this guide: https://forums.raspberrypi.com/viewtopic.php?t=268806
I have downloaded the libraries needed!
I have wired it this way:
The only difference is that I am using a rpi zero 2w
I have installed all libraries and i have written the code, but the rfid module doesnt seem to read or write
Can someone help me?
Discord: Yasen#7752 This is the pins i have wired the module on my rpi zero 2w.
I tried running this code:
#!/usr/bin/env python
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
reader = SimpleMFRC522()
try:
text = input('New data:')
print("Now place your tag to write")
reader.write(text)
print("Written")
finally:
GPIO.cleanup()
but it didn't seem to work!
This is an example output:
pi#raspberrypi:~/pi-rfid $ sudo python3 Write.py
New data:pimylifeup
Now place your tag to write
Written
My program just doesn't print "Written". I am assuming it has something to do with the rfid modules.
Once again the tutorial i am using is: https://pimylifeup.com/raspberry-pi-rfid-rc522/. I have almost no experience as I am only 14, but i would really use some help! Thanks!
Related
Like title, i'm trying to use Qt and FFmpeg to play audio. My code like this:
QAudioOutput *audio_output;
QIODevice *stream_out;
QAudioFormat audio_fmt;
audio_fmt.setSampleRate(44100);
audio_fmt.setChannelCount(2);
audio_fmt.setSampleSize(16);
audio_fmt.setCodec("audio/pcm");
audio_fmt.setByteOrder(QAudioFormat::LittleEndian);
audio_fmt.setSampleType(QAudioFormat::SignedInt);
QAudioDeviceInfo info = QAudioDeviceInfo::defaultOutputDevice();
if(!info.isFormatSupported(audio_fmt))
{
audio_fmt = info.nearestFormat(audio_fmt);
}
audio_output = new QAudioOutput(audio_fmt);
When i use QAudioDeviceInfo info = QAudioDeviceInfo::defaultOutputDevice()
i get PulseAudioService: pa_context_connect() failed error.
So how can i fix it?
By the way, i'm using Ubuntu 16.04 and Qt 5.14.2, and i have add 'mutilmedia' to Qt pro file
I checked my Qt file ,and i have audio dir in plugins, it's not lib problem. Also, i read this post ,but i don't know how to fix it, anybody have idea? Thank you guys,and my English is bad, wish you can understand what do i say.
I installed CircuitPython on my Raspberry Pi Zero W and tried to import usb_hid in Python and it threw the error: ModuleNotFoundError: No module named 'usb_hid'. I've spend all day trying to solve this issue to no avail.
I'm running the default Raspberry Pi OS and I used this tutorial to install the CircuitPython libraries.
My end goal is to use my Raspberry Pi as a mouse that controls another device. I modified the code from this tutorial to come up with this code:
import time
import usb_hid
from adafruit_hid.mouse import Mouse
mouse = Mouse(usb_hid.devices)
time.sleep(5)
while True:
mouse.move(x=100)
time.sleep(0.5)
mouse.move(x=-100)
time.sleep(0.5)
I'm very new to Raspberry Pi's / Python, so maybe I'm just missing something obvious.
I am developing some software in python 3.9 and I am at the point where I have a device connected to my USB port and would like to send a basic packet to test the interface before I proceed. I am using this example to try and get my interface to work. I am not bothered about speed or byte count. I would like to see any response on the interface (But on reflection Im wondering if usb speed could be the issue):
import usb1
import usb.util
import os
import sys
import libusb
import usb.core
from usb import util
import math
dev = usb.core.find(idVendor=0x11ac,idProduct=0x317d)
with usb1.USBContext() as context:
handle=context.openByVendorIDAndProductID(
0x11ac,
0x317d,)
handle.claimInterface(0)
handle.setInterface(0)
data = bytearray(b"\\xf0\\x0f"* (int(math.ceil(0xb5db91/4.0))))
handle.controlWrite(0x40, 0xb0, 0xb5A6, 0xdb91, b"")
handle.bulkWrite(2,data,timeout=5000)
`
https://github.com/vpelletier/python-libusb1/issues/21
I have had a look in various forums for several days and cannot seem to get an answer that works. Here is the trace: Its worth noting that from time to time, this py file does run without error but does nothing, and I see no traffic traveling to the USB interface.
Can someone please help me configure a working example of how to send a packet to the interface? I have tried various things like detaching the kernel, setting configuration, etc.
For 4 days I have struggled with libusb01 & 10, after discovering libusb1, I have changed my wrapper and got a lot more success
I also see a lot of examples in forums like this one, and I always get the same response. Also Im curious as to where it appears that 0x40 is the endpoint(out)
Traceback (most recent call last):
File "/home/jbgilbert/Desktop/Packets/Backend_replace.py", line 16, in <module>
handle.claimInterface(0)
File "/usr/lib/python3/dist-packages/usb1/__init__.py", line 1213, in claimInterface
libusb1.libusb_claim_interface(self.__handle, interface),
File "/usr/lib/python3/dist-packages/usb1/__init__.py", line 133, in mayRaiseUSBError
__raiseUSBError(value)
File "/usr/lib/python3/dist-packages/usb1/__init__.py", line 125, in raiseUSBError
raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorBusy: LIBUSB_ERROR_BUSY [-6]
My device is a laptop, using lsmod reveals all devices linked to that particular end point, in this case because if the presence of a webcam I was unable to write to an available end point. Despite disabling the driver I had no avail and had to try to code on a machine that had less onboard accessories that proved more successful
This is my first project with Python, which I wrote online by Repl.it, (disclaimer: I have very little programming experience), it's supposed to turn on an LED when I receive a message, but this error appears when I run it (I am running it on Windows 10, 64 bits).
import imaplib
import getpass
import email
import time
import serial
import os
os.system('cls')
**ser = serial.Serial("COM3", 9600)**
ser.close()
ser.open()
It says that in the bolded line, 'serial' has no attribute 'Serial', what can I do in order to fix it?
Thanks in advance and sorry for any dumb mistake I may have committed.
Repl.it for whatever reason interprets import serial as the package 'serial', not 'pyserial', even if you manually specify pyserial as a requirement. This is just an idiosyncrasy with the repl.it virtual machine as far as I can tell. Run it on your local machine with pyserial installed and it should work fine.
Preface: I have very limited experience with linux and selenium in general. Also this is a multipart question.
Hi there,
I've written a script that I want to run on my Raspberry Pi model 3B which is running Raspbian OS.
I originally built it on a Windows machine (pretty stupid mistake to build it for the wrong platform but anyway) and now need to adapt it so it runs on the Pi.
The main thing I am concerned about is the usage of selenium and chromedriver. I have downloaded chromium-chromedriver (chromium-chromedriver 34.0.1847.116-0ubuntu2 in armhf (Release)) from this repository.
First Question
The file downloads as a .deb which I have never seen before. It opts to install, however I have no idea where it installs as it does not give the option to install to a different directory. I've tried search for it with find, but nothing comes up. Where does it go by default in Raspbian OS?
Second Question
I know I will have to change some expressions because I am using chromium-chromedriver instead of chrome driver, but I am unsure which ones as I don't know selenium that well. This is the main instance here. Do I just change all instances of "Chrome" including "chrome_options" to "Chromium/chromium_options"?
from selenium.webdriver import Chrome
from contextlib import closing
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--no-sandbox")
#Scrape out the table information
with closing(Chrome(chrome_options=chrome_options)) as driver:
Lastly, for the purpose of finding the process with psutil and ending it with process.kill(), the text ID of the driver in task manager should just be chromium-chromedriver.exe right?
Any and all help and advice appreciated.
Thank you all for your time.
L