pigpio | Fast GPIO , PWM , servo control
kandi X-RAY | pigpio Summary
kandi X-RAY | pigpio Summary
A wrapper for the pigpio C library to enable fast GPIO, PWM, servo control, state change notification and interrupt handling with Node.js on the Raspberry Pi Zero, 1, 2, 3 or 4. pigpio supports Node.js versions 10, 12, 14, 15 and 16.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pigpio
pigpio Key Features
pigpio Examples and Code Snippets
git clone git@github.com:victordibia/tjwave.git
cd tjwave
sudo apt-get install alsa-base alsa-utils
sudo apt-get install libasound2-dev
sudo apt-get install pigpio
npm install
sudo rm -rf node_modules
sudo npm install --unsafe-perm
amixer cset
Community Discussions
Trending Discussions on pigpio
QUESTION
I am using SPI communication to communicate between Raspberry Pi and a microcontroller. I am sending a value of "32" (a 32-bit integer) or "0x00000020" with CRC value calculated by the microcontroller as "2613451423". I am running CRC32 on this 32-bit integer. Polynomial being used on MCU is "0x04C11DB7". Below is the snippet of code I am using on microcontroller:
...ANSWER
Answered 2022-Mar-30 at 04:52I was able to figure out the issues. I used this https://crccalc.com/?crc=C5&method=crc32&datatype=hex&outtype=0 to confirm CRC values that I was getting on microcontroller and RPi.
First issue was on microcontroller, where I was not even performing the CRC on the data, instead I was performing on the address where that data was stored.
Second issue was that MCU was performing CRC on the value which was stored in the little-endian form. On RPi also, CRC was being performed on values stored in little-endian form. Hence, since the endianness was same on both the devices, I did not have to reverse the bits or bytes.
After doing these changes, I was able to get correct and same CRC values on both RPi and microcontroller.
QUESTION
This is a follow up question from: : LP_c_long instance instead of list but is a different issue so I am posting a new question here.
I am using ctypes to invoke a c function from python script. The c function which is being invoked is:
...ANSWER
Answered 2022-Mar-27 at 04:00As @Mark's suggested in comments, you would have to store the data into another variable/list, for example: recv = spi.xfer2(data)
. Then you would need to use this recv in your unpack function.
Further, you could also use a python library called zlib instead of using a c library (there are other python libraries as well).
Another point, since zlib takes only bytes as input, you would need to convert recv into bytes (here recv is a list; check my code). I modified some of your code.
QUESTION
I have this python code:
...ANSWER
Answered 2022-Feb-28 at 17:21The problem can be reduced to the following code. The 2nd parameter was incorrect as ctypes.POINTER(ctypes.c_void_p)
would be used for C void**
not void*
. The other parameters were using signed vs. unsigned types so that has been corrected as well. The data
must be either bytes
or a ctypes
array such as (c_uint8 * 1024)()
to be suitable for c_void_p
.
QUESTION
I am honestly about to just give up, i've tried so many different possibilities, for multiple weeks now, almost a month, of multiple problems.
I am a new-ish programmer, especially with java, but i have a good understanding about java
I am able to create a maven project no problem, i have no problems with the structure of java itself, but i don't fully understand the pom.xml.
The file compiles just fine, but when i go to start it with java -jar (filename)
, i get the following output;
Exception in thread "main" java.lang.NoClassDefFoundError: com/pi4j/Pi4J at com.pi.rasberri.Main.main(Main.java:16) Caused by: java.lang.ClassNotFoundException: com.pi4j.Pi4J at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 1 more
Heres my pom that i have figuratively almost dismembered;
...
ANSWER
Answered 2021-Dec-18 at 16:39Thanks tgdavies, MadProgrammer, and khmarbaise for the answers, the fix was to create a fat jar, which is basically a jar file that contains all the dependencies in one file, example can be found in the original question/comments
Now, as to the other problem, the issue is with this bit of code;
QUESTION
I am trying to convert an ADC bipolar differential signal in C++. The device I am using is a 12 bit MAX11613 (datasheet) and the microcontroller is a Raspberry PI 3B+. So far I am able to capture values, however the results are not the differential result of AIN0 and AIN1 I would expect.
The device is a 3.3V supply and the input on AIN0 is 0-3.3V. The input on AIN1 is the virtual ground of the incoming signal at 1.65V.
The bipolar transfer function of the device shown below may be my source of confusion. Why is it that a value just under the midrange of 1.65V would produce a value of 0b111111111111 and not 0b100000000001? And if that is actually correct, how does one adjust for that to reflect an actual negative voltage compared to the virtual ground input (AIN1)?
For what it's worth, here's my code:
max11613.h
...ANSWER
Answered 2021-Dec-07 at 22:29Updated original code with final working detail.
I used the pigpio library to control the read and write to the chip. Setup function runs first to complete chip setup and configuration, then reads are called as needed.
Many, MANY thanks to alagner for assistance reviewing code and troubleshooting!
QUESTION
I am trying to read GPIO port 5 on a Raspberry pi, after trying some packages like onoff I decided to use Pigpio. It does connect to GPIO but the problem is that I dont have permissions for that user. It says:
Sorry, you don't have permission to run this program Try running as root, e.g precede the command with sudo. /home/pi/IsriBruster-service/node_modules/pigpio/pigpio.js:54 pigpio.gpioInitialise();
The code I run for calling gpio is the next one:
...ANSWER
Answered 2021-Nov-11 at 12:51I tried this with the onoff library and it worked finally:
QUESTION
I want to monitor for a specific GPIO pin which has a button connected to it and depending on the number of times the button has been pressed it will either turn on some LED lights, make them blink or turn them off.
...ANSWER
Answered 2021-Nov-09 at 10:00To my knowledge, there are three ways to store data 'beyond their scope'.
- A global variable - This variable is, as you know, shared across all calls and can be referenced even outside the compile unit.
- A
static
variable - This type is limited to the scope it is defined in, inaccessible from the outside, but, once again, shared among all calls. - Parameters, which are passed into your function.
The way I understand your question, you do NOT want to share the value of the variable across all instances of your call, which automatically disqualifies 1. and 2.
As such, you will need to pass the required information into your function from the outside.
While you could just pass the current_state_id
into your function set 'as is', this requires the user of your library to know a thing or two about how your library works.
A better solution would be a context structure, which hides the interna of the data you need and gives you the flexibility to add/remove data from within, without having to worry about changing your API.
A normal approach to this would look something like this:
QUESTION
I am new to CMake and was hoping to use a pretty simple Raspberry Pi application as a learning experience. I have a few files in a simple directory structure, plus I'm using pigpio. My code compiles fine by itself, but when I use CMake to generate a makefile, the makefile cannot find the references in pigpio. pigpio includes a file, Findpigpio.cmake
, in the util
directory, so I tried including it in CMakeLists.txt
, but to no avail.
File structure:
...ANSWER
Answered 2021-Oct-28 at 19:47I don't actually know about pigpio specifically. But from a pure cmake perspective you need to pull in the pigpio CMakeLists.txt and add that library as a link dependency. The include(pigpio/util/Findpigpio.cmake)
is unnecessary.
QUESTION
I am building a DIY sonar using a Raspberry Pi, an ultrasonic sensor and a servo motor and so far I've managed to make it generate a picture/map on each 180 degree sweep but the problem is that I also want to show this picture on a local webpage and I want to make it auto-update on each sweep without the user having to manually refresh the page (each sweep does not last the exact same as the previous one - that is one problem). I have thought of using the BottlePy micro web framework as well as some jSON. Here is the code:
Python:
...ANSWER
Answered 2021-Aug-17 at 19:12From this question: Refresh image with a new one at the same url, you can try adding a catchbreaker, essentially forcing the browser to reload the image instead of taking it from the cache.
QUESTION
I'm trying to make a custom node in Node-red, but as I drop the node into the flow, the node is "stuck" and unusable. The error from the console(F12) is:
...ANSWER
Answered 2020-Nov-04 at 16:15I suspect the editor expects your node to have a defaults
property in its HTML definition, even if it's an empty property.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pigpio
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page