New answers tagged

0

A littlebit late, but as can be found here: http://wiringpi.com/download-and-install/ simply type sudo apt-get install wiringpi This installs the gpio command.


0

Use a MUX or logic gate and create a function that does two things while gpio reacts differently. This way you can do that.


1

If you are using a fresh image you don’t need to install it. For the old version sudo apt-get update sudo apt-get install rpi.gpio


3

Your previous program run must have exited but left GPIO pins in use. The next run of the program is warning you that it is reassigning pins that are in use. If you execute GPIO.cleanup() before the program exits then it won't happen.


1

According to the official docs you can switch off their usage in /boot/config.txt. Just set force_eeprom_read to 0. force_eeprom_read=0 Taken from: https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md force_eeprom_read Set this option to 0 to prevent the firmware from trying to read an I2C HAT EEPROM (connected to pins ID_SD & ...


2

Don't use GPIO.cleanup() until you want the script to exit.


0

Is there a device that e.g. uses i2c to set it's pin states? Yes, they are so called I2C expanders (already mentioned and linked on some other comments). For 100+ pins hovewer I strongly advise against branching them off a single Pi, I cannot really imagine how to route them for example in a building automation project. Cool thing is I2C can be more or less ...


2

Try the 74HC595 (link here) I have not used one myself, but have heard about them, I think it should work because my friend has used it successfully with an arduino.


2

I've not used one personally, but this should do the job: http://www.nationelectronics.com/raspberry-pi-extensions/174-raspberry-pi-hat-32-io-port-expander-v11-mcp23017-i2c-black-0648260628239.html It does cover the whole Pi, but should only be using I²C to set the pin states (it is what they say) allowing you to use other pins yourself. You can stack them ...


1

The option you are looking for is display_hdmi_rotate in https://www.raspberrypi.org/documentation/configuration/config-txt/video.md: value 0x10000 should perform a horizontal flip, 0x20000 a vertical one.


1

It's next to impossible to say for sure what is wrong with a self-compiled binary. Try installing an official version, e.g. for Buster there's https://packages.debian.org/buster/openocd If there's a reason you must use the binary you have, you may want to try using -c "script openocd-pi.conf" instead of -f openocd-pi.conf. Double check the syntax ...


0

The build date (2018-06-09) on that binary is from before some major (good) changes were made to openocd. The raspbian source image is probably from the same version you had the binary for. My suggestion is to get the source from git and compile it yourself: git clone git://git.code.sf.net/p/openocd/code openocd cd openocd ./bootstrap declare options="-...


0

Got it working by doing the following for anyone coming here searching a solution to the same problem with the Sunfunder 10 inch touchscreen. #!/bin/bash idletime=60000 # in milliseconds screen_toggle=1 while true; do idle=`xprintidle` #echo $idle >> /home/pi/idle.log if [ "$idle" -gt "$idletime" ] && [ "$...


0

This code will set the output Low for about 1 microsecond then reconfigure it as an INPUT. So depending on what is connected this is expected. If you want the state to persist remove the call to cleanup.


1

Probably found an answer thanks to @joan 's answer. It seems like RPi.PWM can only do software PWM, but the fan requires hardware PWM to run as smooth as possible. To do hardware PWM on any GPIO pin, the pigpio daemon has to be executed, and controlled by Python. Therefore, pigpio has to be installed first and configured to be started on boot (systemd). ...


0

There are two fundamental differences between the two approaches. The gpio utility (part of wiringPi) is using hardware timed PWM. appears to be setting a frequency of 40 kHz. The RPi.GPIO script is using software timed PWM. is setting a frequency of 50 Hz. I'd guess the frequency is the main factor.


0

Use a MUX IC between the sensors and the pin. That should work.


1

The problem is caused by the line range(100) and None which is causing your loop to exit. You need to remove it. Where did it come from? It's not in the docs. If you want to loop 100 times, change the while True: to for i in range(100): Also it's probably just the way you pasted in the code here but your first line is indented, just make sure it isn't ...


1

I would look to use the gpiozero module as that’s more powerful but saying that the cleanup function is designed to reset all pins as it’s the last thing you should do in your program NOT part way through. Also the setting of the pin mode should only be executed once in your program. Normally, you would ‘reset’ the output by putting a high or low voltage ...


4

See RPi.GPIO documentation. Cleanup At the end any program, it is good practice to clean up any resources you might have used. This is no different with RPi.GPIO. By returning all channels you have used back to inputs with no pull up/down, you can avoid accidental damage to your RPi by shorting out the pins. Note that this will only clean up GPIO channels ...


3

Welcome. For some reason (historic that made sense at the time I am sure), the Pi4J project followed the WiringPi software for pin layout. To quote their site: Pi4J (by default) uses an abstract pin numbering scheme to help insulate software from hardware changes. Pi4J implements the same pin number scheme as the Wiring Pi project The good news is that ...


1

Probably your electrodes got dirty. For a quick solution, you can clean them, preferably with alcohol. For a long term one, you can improve your design with a different sensor. E.g. use your floater to activate two fixed photo gates, or induction sensors/hall sensors with a magnet on the floater. Or even better: use an ultrasonic sensor to measure your water ...


1

No, the GPIO pins can not be used to drive a DC motor. They can only supply a few milliamps of current at 3V3 which will not be enough. In addition driving any inductive load direct from a GPIO is likely to destroy the GPIO and the Pi. An inductive load is such as a DC motor or a relay coil. You need a motor driver board or chip or discrete components (e.g. ...


2

You could use something like the Perma-Proto HAT to make an adapter between the Pi and the relay board. Use the regular 40-pin header to connect the Proto to the Pi, then solder on a custom 6-pin header to the Proto to mate with the relay. This would make the package a bit thicker, but would avoid wires and maybe you could use the Proto for other components ...


2

This will require you to modify the traces on the pi's PCB. While it is possible it is not recommended. If looks concern you you would be better to get a case for the pi and relay.


2

The output of gpio readall (which is deprecated) DO NOT show "default states" - they only show nominal usage and DO NOT show any user defined changes (although this does show the actual state (High/Low) of pins. E.g. unless you specifically enable serial pins 8,10 are just GPIO inputs. My program gpioread reads the ACTUAL state - and there are ...


1

Three possible reasons: 1. Because it has slow processing rates , thus it has lower sampling rate. 2. Because of the hardware configuration. 3. The hardware can not generate the processed signal.


2

Expected scenario: always turn off the bulb when the pi disconnects, turn on the bulb only from the script NOTE: Please know this answer disregards all comments made to the OP's question. The issue you're facing cannot be solved with software alone. You will need to add some hardware if you wish to maintain positive control of your relay at all times. As ...


4

You do not understand the way GPIO work. You can control GPIO pins, setting High or Low, and the pins retain their state, even if the Pi is shutdown. When you remove the Pi power the pins become undefined. On re-applying power the GPIO pins are configured as INPUTS, with either a weak pullup or pulldown, which depends on the pin. The pins ONLY become ...


4

None of the GPIO pins are 'multiplexed' in the sense you mean. In other words, some of the GPIO pins have alternate functions, but these are functions that you maintain control of in your configuration, and in your code. You do not need to worry about the system commandeering a GPIO pin for some other purpose. There are many sources of detailed information ...


1

No pins are "multiplexed" with ANYTHING. Pins 27,28 (GPIO0,1) are reserved for HATs.


Top 50 recent answers are included