-
Notifications
You must be signed in to change notification settings - Fork 0
Control LED strip with WiringPi
Here how to control an LED strip with 4 pins (5v, r, g, b -> The led strip is a rgb 5050) with WiringPi (a c library for the raspberry pi compatible with c++).
See here for setup
https://learn.sparkfun.com/tutorials/raspberry-gpio/c-wiringpi-setup
See here for how to use
https://www.digikey.com/en/maker/tutorials/2019/how-to-use-gpio-on-the-raspberry-pi-with-c
If you get the error
'Oops: Unable to determine board revision from /proc/cpuinfo -> No "Hardware" line -> You'd best google the error to find out why.'
when calling gpio -v
, like it did happen to me,
see here
https://raspberrypi.stackexchange.com/questions/145031/wiringpi-giving-unable-to-determine-board-revision-from-proc-cpuinfo-error-af
Basically you have to do this:
You can solve the "No "Hardware" line" - problem by editing the file ~/WiringPi/wiringPi/wiringPi.c
There is a procedure (original at line 747) : int piGpioLayout (void)
Below that you have a line
#ifdef DONT_CARE_ANYMORE
Move this line UP just below the first call of piGpioLayoutOops().
This should now look like this : ... ... if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL) piGpioLayoutOops ("Unable to open /proc/cpuinfo") ; #ifdef DONT_CARE_ANYMORE
// Start by looking for the Architecture to make sure we're really running ... ...
This prevents the check of the (no longer existing) 'hardware' line, but keeps the Revision check functional.
Save the file and run the WiringPi build script again: cd ~/WiringPi ./build
WiringPi should work now as usual.
I tested it on a Raspberry Pi 4 without problems (so far), but it may lead to problems on older pis with different pinouts.