14 votes

Control Hardware PWM frequency

According to this formula: pwmFrequency in Hz = 19.2e6 Hz / pwmClock / pwmRange We can set pwmClock=1920 and pwmRange=200 to get pwmFrequency=50Hz: 50 Hz = 19.2e6 Hz / 1920 / 200 I test it on ...
kev's user avatar
  • 356
6 votes
Accepted

wiringpi is missing from bullseye. how do i install it?

Wiringpi is deprecated. You may be able to install the last release from the author's website which may or may not work on Bullseye. There are a few alternative libraries. See Controlling Raspberry Pi ...
Milliways's user avatar
  • 58.6k
5 votes
Accepted

Using BCM GPIO pin numbers with wiringPi C library

To set a pin numbering scheme you use one of four Setup functions: int wiringPiSetup (void); int wiringPiSetupGpio (void); int wiringPiSetupPhys (void); int wiringPiSetupSys (void); To use BCM GPIO ...
Steve Robillard's user avatar
5 votes
Accepted

I2C using wiringPi or IOCTL in C, more than 2 bytes

I'm wondering, may understand that Raspberry Pi's I2C is in fact the SMBus version of I2C ? I don't think it is limited in that sense but that is the normative way to use it. There is no such ...
goldilocks's user avatar
  • 58.5k
5 votes
Accepted

WiringPi: change output of GPIO pins synchronously?

It's possible with a very minor caveat. When you set a GPIO high or low you write to one of two registers. A set register to set selected GPIOs high. A clear register to set selected GPIOs low. ...
joan's user avatar
  • 70.5k
5 votes

WiringPi error etates I'm not Using an RPi

I ran into this same problem using Java with Raspbian on a Pi 3 and found a posting from the Pi4J development team indicating that the problem is that when Pi4J is automatically installed, a copy of ...
Richard Chambers's user avatar
5 votes

Is this behaviour of GPIO pins normal?

On many electronics boards, GPIO pins are set to a "floating voltage" (not on, not off, just somewhere in the middle) until the pin actually gets initialized or used for the first time. Remember, ...
tlhIngan's user avatar
  • 3,372
5 votes

Is this behaviour of GPIO pins normal?

Most of the pins are configured as inputs. This is normal, and usually the safest option. All of these inputs are put into a defined state with either a pullup or pulldown. The normal values are ...
Milliways's user avatar
  • 58.6k
5 votes
Accepted

how to read output of gpio readall

The ALTx signifies the alternate functions of a pin. See this for a better understanding. BCM is the pin number when using GPIO (aka BCM) numbering scheme, and wPi is the pin number when using the ...
stevieb's user avatar
  • 1,476
5 votes
Accepted

Cross compiling for RPi - error while loading shared libraries

Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI. This is different from static libraries. ...
RalfFriedl's user avatar
  • 2,188
5 votes
Accepted

multiple UARTs on the 40-pin

so where was one big misunderstandings. thanks to @joan for pointing to the docs and @tlfong01 for their link to their article: https://penzu.com/public/b94e6b30 essentially, on the raspberry 4, there ...
rmalchow's user avatar
  • 171
4 votes

Output Accurate, Detailed PWM signal

The Pis with 40 pin expansion header (and the compute module) have two hardware PWM channels which you should be able to use with wiringPi. That would give you control of two ESCs. From the software ...
joan's user avatar
  • 70.5k
4 votes
Accepted

Using Wiringpi in crontab to control GPIO pins on RaspberryPi

The most common error in crontabs seems to be not giving the full paths to programs or data used. Use the which command to find where gpio is stored on your machine (probably /usr/local/bin/gpio) and ...
joan's user avatar
  • 70.5k
4 votes

How to run 2 servos with wiringpi2 on Raspberry pi 2

Lucky to see this question, I just spent weeks on controlling two servo (SG90) using WiringPi and programming in C, there're three things that I recommend. 1.Using BCM GPIO instead of WiringPi Pin ...
Mou's user avatar
  • 41
4 votes

Can we determine the mode of a GPIO pin?

Yes you can. Use getAlt(int pin) method for that from libwiringPi.so (or wiringPi.h). It will give you direction of that pin.
Vir's user avatar
  • 196
4 votes
Accepted

WiringPi pin numbering for RPi 2B and 3B?

The side where your micro sd card is the upper side, the first number is your gpio pin number from the RPi itself (in ascending order) then there is the Broadcom number, and between the parenthesis as ...
Rizzle Light's user avatar
4 votes
Accepted

How do you force wiringPI library to use local time instead of UTC time?

The use of UTC time seems to be hardcoded in ds1302 utility. Note the following line: gmtime_r (&now, &t) ; This converts your system time to UTC, before writing it to the DS1302 chip. When ...
Dmitry Grigoryev's user avatar
4 votes

Is this behaviour of GPIO pins normal?

The programmable pins (General Purpose Input/Output) can be used in a variety of ways - but not all at the same time. Before the point where power is applied to the RPi's Systen-on-Chip (Soc) AND it ...
SlySven's user avatar
  • 3,611
4 votes

Wiring Pi - Root not required?

wiringPi was modified to allow the use of /dev/gpiomem rather than /dev/mem to access the GPIO. To access the GPIO via /dev/mem requires root privileges. By default /dev/gpiomem can be accessed by ...
joan's user avatar
  • 70.5k
4 votes
Accepted

Why is WiringiPi unable to find hardware revision?

WiringPi is not supported on any other operating systems than Raspbian - so its likely this feature is not supported in Ubuntu. WiringPi is developed directly on a Raspberry Pi running 32-bit ...
CoderMike's user avatar
  • 6,827
4 votes
Accepted

says i don't have wiringpi module when runing code at startup

You cannot use ~/.bashrc to run a program at boot up. It is to configure bash and runs only with bash sessions and not at boot up of the RasPi. To have a service started on boot up you best use a ...
Ingo's user avatar
  • 41.9k
4 votes

GPIO pins not changing state

You are confusing wiringiPi numbers with GPIO numbers. The sysfs interface uses GPIO numbers. The highlighted GPIO is GPIO 26 (wiringPi 25). GPIO 25 is connected to pin 22. See https://pinout.xyz/
joan's user avatar
  • 70.5k
4 votes

wiringpi is missing from bullseye. how do i install it?

I was successful with "Rasberry PI OS Bullseye" using this fork: https://github.com/WiringPi/WiringPi cd /tmp wget https://github.com/WiringPi/WiringPi/releases/download/2.61-1/wiringpi-2.61-...
fishbone's user avatar
  • 151
3 votes

pwm fan on pin 18 help!

Your fan probably has a voltage drop that is too high for the Pi's GPIO to power it. The GPIO pins only output 3.3v 50ma MAX.
Patrick Cook's user avatar
  • 6,365
3 votes

How can I use a usb barcode reader with my raspberry pi

Your card reader is a usb card reader that acs like a keyboard and spits out the value as if keys were being pressed. It looks as if you should be able to use the fgetc()function in php to get ...
Curious Programmer's user avatar
3 votes

I2C using wiringPi or IOCTL in C, more than 2 bytes

It's a limitation of wiringPi. It only implements a couple of SMBus commands. As you say using SMBus commands you are limited to 32 bytes. Using the raw device you can send hundreds at a time. I'm ...
joan's user avatar
  • 70.5k
3 votes
Accepted

Wiring a 3 pin toggle switch to Raspberry Pi 3

This is a two state system -- the switch is either to the left or to the right. Since there are three pins, and presuming two of them are not hardwired together, this means the switch position ...
goldilocks's user avatar
  • 58.5k
3 votes

SystemD unit dependencies to start wiringPi GPIO application

I believe there's a degree of indeterminacy with regard to execution order. If this isn't required by anything else, and isn't required to happen before anything else, then it won't be a priority. ...
goldilocks's user avatar
  • 58.5k
3 votes
Accepted

How to address gpio pins

There are several different GPIO numbering schemes. You need to ensure that the software you are using is using the numbering scheme you expect. See https://pinout.xyz/ for the gory details. The ...
joan's user avatar
  • 70.5k
3 votes
Accepted

How to read gpio current mode in shell or wiringpi

pigpio offers a method to read the GPIO mode from C, Python, and the shell. C http://abyz.me.uk/rpi/pigpio/cif.html#gpioGetMode Python http://abyz.me.uk/rpi/pigpio/python.html#get_mode shell http://...
joan's user avatar
  • 70.5k

Only top scored, non community-wiki answers of a minimum length are eligible