Yes. The definitive source for RPi hardware documentation is the Raspberry Pi Foundation. The Foundation updated their published documentation to include programmable GPIO current limits recently (Jan, 2019), and the latest "official documentation" of the GPIO docs can be found here.
In general, The Foundation's "official documentation" is published in the ...
You should import the GPIO library as import RPi.GPIO as GPIO than reference it by using GPIO.
Also packages for python 3.x require you to use pip3 install rather than sudo apt-get install python3-rpi.gpio as it doesn't require elevated privileges and has access to the python package index (pypi.org)
That's one way of doing it - it will work. The better way is to use GPIO.wait_for_edge(17, GPIO.RISING) which will pause at that line until the button is pressed (on a RISING or FALLING edge).
However, BOARD numbering pin 17 is not a GPIO, it's 3V3.
You could also use GPIO Zero which is more intuitive (and uses BCM numbering):
from gpiozero import Button
When you have a recursive function like this (one with too much depth potential), you need to convert it into a loop. In this case you have two functions alternating calling each other:
This will loop forever (as does the original version, you are exiting on a signal), but you can also use some kind of state as a ...
The preliminary Pi4 datasheet shows there are 6 UARTs.
Given that UART 0/1 are both connected to the same GPIO you can only use one of them at any one time. So potentially there are 5 accessible UARTs at any one time.
You can enable each of the UARTs on the Pi4B by making appropriate ...
How can Rpi read 50 digital inputs with quick response？
Any Rpi GPIO port expansion boards available？
Any customizable Rpi compatible LCD GUI screen？
How to connect Rpi to a Midi device, to make it as portable as possible?
My short answers
The usual recommendation is IO port expansion chips such as MCP23017 or MCP23S17. MCP23x07 ...
As far as I am aware it should work provided you download and install the latest version of wiringPi.
sudo dpkg -i wiringpi-latest.deb
Yes, it is possible to control the built-in leds. Green LED is easier.
According to here, though it is probably Pi 3 specific, since it didn't work for my Pi 4:
In the terminal:
sudo echo 1 > sudo /sys/class/leds/led0/brightness
This turns the green led on.
sudo echo 0 > sudo /sys/class/leds/led0/brightness
To turn off the activity indicator ...
It's possible that this might mirror something I was doing a couple of years ago and I preface this with the observation that I don't believe that it was good practice, but I didn't find a way around it, so I welcome any correction.
The issue (in my case) was that running a python program that accessed the GPIO pins required root access. If you are going to ...
Yes. There are several ways this can be done. The method used will depend upon the characteristics of the load connected to the relay's contacts.
As @OyaMist has stated, "the actual relay state may differ from its nominal state". From a distance, when the relay state must be known, we are reduced to making a simple assumption; i.e. "...
This shows (my) pigpio library being used to control a variety of devices.
A Raspberry Pi controlling a variety of motors and sensors.
The pan-tilt head is moved by a pair of servos. The head holds a
sonar ranger and an ADXL345 3-axis accelerometer. The servos control
pins are connected directly ...
How to use a NPN transistor to "turn on" a Rpi GPIO pin?
Ah, you cannot "turn on" a Rpi GPIO pin. She won't listen to you, but you can ask her to behave as input or output! :)
In geek English:
A Rpi GPIO pin can be in "input mode" or "output mode".
An "input" pin can input/read a signal which can be High or Low.
An "output" ...
To determine what your program is doing, you need to save the output of the program to a file. Use this type of call to start the program
/path/to/script >> /path/to/log/file 2>&1 &
This will start the program in the background, and send all output (both stdout and stderr) to a file of your choice.
Keep in mind that if the script is long ...
After hours of hitting my head against the wall I tried to connect it directly without passing through the level shifter and it worked... I don't understand exactly why it is, I suppose it's because of the pulldown resistors or something like that but can tell exactly.
I'm going to post this as an answer because I had a lot of trouble researching how to drive an ESC with just a Rasp Pi(using a zero w) and it works now, Hopefully someone having the trouble finding out how will see this:
Joan was completely right with the 1000 low and 2000 ms high pulse width.
I ran the GPIO pins at 50 hz. Here is some light arithmetic ...
It is safest to introduce a resistor.
Connect any Pi ground pin to any of the other Pi's ground pins.
Connect any Pi GPIO pin to any of the other Pi's GPIO pins via a resistor (if you have one, anything between 300 ohms to 100 thousand ohms will do).
Set the transmitting GPIO as an output and the receiving GPIO as an input.
The resistor is ...
The GPIO is still working, it's the software refusing to continue without a warning unless you correct the condition causing the warning.
Either do what the warning message says or add the following line at the (logical) end of your script.
Arguably, the best way is to use the package manager still (downloading the packages manually), because the installation process will keep track of the dependencies for you.
First, you will need to download the package. You can do it either using the browser from http://archive.raspbian.org/raspbian/pool/, or by adding the content of Raspbian's sources.list ...
On the first RPi :
In a first terminal : (create FIFO)
In a second terminal : (Write datas into FIFO)
readfifo-writeUART.py : pyserial short-intro
with serial.Serial() as ser:
ser.baudrate = 19200
Yes, as long as the signal is 3V3 compatible.
You could use the Pi's UART RX pin (pin 10, GPIO 15) and the standard Linux serial software. That will handle standard baud rates (say up to 1 Mbps).
Alternatively you can use a general GPIO (any other GPIO on the extension header) and software serial. That should be good up to 19k2 bps or so.
Turns out that the official package for the MFRC522 module was written in python2 and hence causing the issue.
I found an updated package by a user on github and it works fine now.
Github Link to the package
So, after digging some more and finding this article: https://forum.arduino.cc/index.php?topic=477085.0, it looks like the issue has to deal with interference somewhat.
I decided to just run the third one on spi0 and things are working the way I want them to.
You need to pull the GPIO to either 3V3 or ground in each switch position.
If you connect one end of the switch to ground it would be normal to connect the other end of the switch to a GPIO with a pull-up to 3V3.
If you connect one end of the switch to 3V3 it would be normal to connect the other end of the switch to a GPIO with a pull-down to ground.
Obviously, the interpreter is attempting to iterate result, which (in the case your program crashes) isn't iterable because it's of typeNoneType. It seems like execute() returns None in result = execute(cmd). Looking at that function, there are two possibilities:
port.read(100).decode() returns None. That's unlikely the case because the function is supposed ...
What do you mean by image is corrupted ?
If it's an installation issue with WIn32DiskImager, here's my experience:
I just installed Raspbian on an SD Card this morning and I got an error too but went to Raspbian official doc and found Etcher which work really well and even have a portable version !
Here's the release page of their Github, you'll find what ...
If I've understood your question the alarm condition triggers correctly but pressing the button again to cancel it early does not work and you have to wait for your 3 minutes timeout?
I think part of the problem is the logic on the while... : line in the swState function. You want the code to stay in the loop "while" two conditions are true:
The timer has ...