Hot answers tagged

13

You need to stop the pigpio daemon if you run a program directly linked with the pigpio C library. In effect your program becomes the pigpio daemon and only one may be running at a time. So sudo killall pigpiod Then run your C program. While your C program is running it acts as the daemon, so you can still run gpiotest and any of the pigs commands, e.g. ...


8

Since this topic is very poorly covered and Sebastião's snippet and helped me to solve this problem I want add a complete solution on how to setup a RaspberryPi right here (tested on a RPi 3 and Zero W)! Setting up a working slave: Preparations Be sure to have commented out this line in your /boot/config.txt: dtparam=i2c_arm=on Dependencies Next, ...


7

I'm not sure if anyone will write the code for you. It's too broad a question. You need to acquire a basic understanding of Python programming first, otherwise you'll be forever asking questions. Personally I'd use the Python curses module (import curses) to handle keyboard entry. There are example of using curses within pigpio at http://abyz.me.uk/rpi/...


6

This is almost identical to your previous question. You probably should have edited that rather than asking a new question. You need the bscXfer to be within the while loop. That is how the xfer structure is updated with new information.


6

It is not possible. Page 100 of BCM2835 ARM Peripherals GPIO Pull-up/down Register (GPPUD) SYNOPSIS The GPIO Pull-up/down Register controls the actuation of the internal pull-up/down control line to ALL the GPIO pins. This register must be used in conjunction with the 2 GPPUDCLKn registers. Note that it is not possible to read back ...


6

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 ...


5

That is a fault in pigpio/gpiotest and/or the hardware revision returned by the Pi Zero W. gpiotest relies on pigpio to tell it which GPIO are safe to write. pigpio relies on the hardware revision returned by the Pi to assemble the list of safe to write GPIO. If pigpio does not understand the hardware revision it defaults to granting access to GPIO 0-31. ...


4

pigpio daemon C I/F to pigpio daemon Socket commands and responses Examples of usage (in the download): from Python is pigpio.py from C is pigs.c from C is pigpiod_if.c using C I/F to daemon is x_pigpiod_if.c


4

hardware_PWM >>> set_PWM_dutycycle >>> software PWM where >>> is orders of magnitude better pulse stability. hardware_PWM rock solid pulses large choice and range of frequencies large number of steps between off and fully on set_PWM_dutycycle very stable pulses, unlikely to be affected by anything other than sustained heavy network traffic. 18 different ...


4

By default pigpio uses the PCM peripheral to time the DMA leaving the PWM peripheral free for standard audio. Perhaps your ALSA device is using high quality audio. If that's the case you need to use the PWM peripheral to time the DMA leaving the PCM peripheral free for high quality audio. To do that from C use gpioCfgClock. Perhaps gpioCfgClock(/* ...


4

If you are running piscope on a Pi enter the following commands. sudo pigpiod # Start the daemon if not already running. piscope & # Run piscope in the background. The main piscope display will be blank until there is GPIO activity. You can trigger activity with the following command. pigs p 4 64 # Start 25% dutycycle PWM on GPIO 4 pigs p 4 0 # ...


4

The Raspberry Pi has 16 hardware DMA (Direct Memory Access) channels. Using DMA you can copy the contents of memory from one memory address to another memory address without software involvement. The hardware allows you to chain many transfers together such that the next is automatically started when the previous has finished. You can also pace (i.e. time)...


4

Errors are reported to /dev/pigerr on the Pi running the daemon. So cat /dev/pigerr may provide useful information. You can enable tracing of the API by using the pigs csi command. Numbers 1 to 7 should uncover more tracing. Try something like pigs csi 5 or pigs csi 6. The results will be sent to /dev/pigerr.


3

Actually the pigpio Python module can do this quite easily for a single stepper. You would use the wave functions in combination with wave chains. Say you want a ramp of 20ms, 10ms, 5ms, 2ms, 1ms. You could create separate waves with 10ms on 10 ms off, 5 ms on 5 ms off, ..., 500 µs on, 500 µs off. You could then use a wave chain to send the first wave ...


3

It sounds like you were lucky in that the Pi appears to still work. To test the GPIO use either my gpio test (requires pigpio) or wiringPi's pintest utility. These test the basic GPIO functions.


3

Okay, you are using GPIO 8 to power the DHT22. GPIO 8 is actually the chip select for channel 0 of the main SPI device. So choose another GPIO, or power the DHT22 from 3V3 and set the power parameter to None (or omit it completely) when starting the DHT22. Note, if the SPI port was not properly closed it may fail to initialise properly at the next SPI ...


3

I'm not going to delve too deeply into the code. I had a look at the datasheet and it seems to encode the reading in the low time over some sort of interval. It seems a little light on details. A first attempt would be something along the following lines. #!/usr/bin/env python # low_high.py # 2015-11-05 # Public Domain import time import pigpio RX=24 ...


3

The commands you can send via the pipe interface are shown at http://abyz.me.uk/rpi/pigpio/pigs.html For the pipe interface each command should be terminated in a new line character ("\n") and you may need to flush output to force the command through the system. Mind you I'd expect you have to do exactly the same with servoblaster. There are two PWM ...


3

You can reliably read Wiegand devices with my pigpio library. There is C, C++, and Python example code at http://abyz.me.uk/rpi/pigpio/examples.html


3

The only problem I can see with the code is that it terminates straight away. When the program ends the pigpio library will shut down so servo pulses will stop. I suggest you add a time_sleep(10) or so to see the servo move. Here is a longer example. Change the 0 at the end of each line of servoInf to 1 if a GPIO is connected to a servo. #include <...


3

I do not remember why the limit is 250k rather than say 500k or 1000k. I expect there was a reason. It may simply have been there was too much jitter at the higher bit rates to reliably clock the data. I suggest you have a look at the code and examine the consequences of changing the constant PI_BB_SER_MAX_BAUD to 1000000.


3

pigpio will be able to send any infrared code you know how to construct. pigpio also provides a wrapper to capture and send well behaved codes. By well behaved I mean codes which don't change from press to press and are not a ludicrous number of bits long (some IR codes are a pretty unnecessary hundreds of bits long). In the first instance try this IR ...


3

The difference is whether you put the padding on the left or the right side of the data. The Adafruit implementation seems to start sending data immediately, which leaves the last 7 bits as padding, whereas keeping the first 7 bits as padding gives you the data in the last two bytes as in your implementation. While the datasheet shows the padding before the ...


3

You can use a break-out board like the Black HAT Hacker or Pico HAT Hacker. Alternatively, connect another Pi Zero as a USB gadget and use the GPIO expander.


2

You need to have a short delay after triggering a DHT22 reading to allow the returned data to be received and processed. A reading is triggered by holding the output line low for about 20ms. When the line is released (left to float) the DHT22 will return a reading. The data is returned as a preamble followed by the 40 data bits (two bytes for temperature, ...


2

Your infinite loop condition is wrong - while (0) is the same as while false, which means the loop never gets run. Change this to while (1) and you get an infinite loop. Regarding the first code - since the main loop only has a sleep(300) in it, it will terminate as soon as the sleep is over, since you have your Wieg_cancel and gpioTerminate calls straight ...


2

I think your code is wrong because you do a while pi.read(25) == 1. If the code runs and your pin is at zero, it will run to its end and finish. You should try with a while true and inside the while block, place an if pi.read(25) == 1 statement with the "detection" string and the sleep statement.


2

You need to find out which other process is using it. Then kill that process. This issue is documented on the FAQ page linked below: http://abyz.me.uk/rpi/pigpio/faq.html#Cant_initialise_pigpio_library


2

As flakeshake pointed out and then deleted for some reason, this is only an issue if you intentionally want to do things the wrong way. All of the documents you refer to make it very clear the point here is don't use signal(). It exists because it's part of ANSI/ISO C, i.e., it has to for compatibility with ancient code. To be blunt: If it is too hard for ...


2

No, changing the range will make no difference to the underlying number of steps between off and fully on. The following table shows the permitted PWM frequencies at each sample rate. Hertz 1: 40000 20000 10000 8000 5000 4000 2500 2000 1600 1250 1000 800 500 400 250 200 100 50 2: 20000 10000 5000 ...


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