pigpio | Fast GPIO , PWM , servo control

 by   fivdi JavaScript Version: 3.3.1 License: MIT

kandi X-RAY | pigpio Summary

kandi X-RAY | pigpio Summary

pigpio is a JavaScript library typically used in Internet of Things (IoT), Nodejs, Raspberry Pi applications. pigpio has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i pigpio' or download it from GitHub, npm.

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

            kandi-support Support

              pigpio has a medium active ecosystem.
              It has 882 star(s) with 87 fork(s). There are 33 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 5 open issues and 122 have been closed. On average issues are closed in 16 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of pigpio is 3.3.1

            kandi-Quality Quality

              pigpio has 0 bugs and 0 code smells.

            kandi-Security Security

              pigpio has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pigpio code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              pigpio is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              pigpio releases are not available. You will need to build from source code and install.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pigpio
            Get all kandi verified functions for this library.

            pigpio Key Features

            No Key Features are available at this moment for pigpio.

            pigpio Examples and Code Snippets

            TJ Wave,How It Works
            JavaScriptdot img1Lines of Code : 21dot img1no licencesLicense : No License
            copy iconCopy
            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   
            Pi-IO,Installation
            JavaScriptdot img2Lines of Code : 4dot img2License : Permissive (MIT)
            copy iconCopy
            pigpiod -v
            
            sudo apt-get update
            sudo apt-get install pigpio
            
            npm install pi-io
              

            Community Discussions

            QUESTION

            CRC-32 values not matching
            Asked 2022-Mar-30 at 04:52

            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:52

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

            Source https://stackoverflow.com/questions/71641185

            QUESTION

            Python bytes buffer only giving out zeros even though data is being correctly received through SPI on Raspberry Pi
            Asked 2022-Mar-27 at 04:00

            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:00

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

            Source https://stackoverflow.com/questions/71304356

            QUESTION

            : LP_c_long instance instead of list
            Asked 2022-Feb-28 at 18:19

            I have this python code:

            ...

            ANSWER

            Answered 2022-Feb-28 at 17:21

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

            Source https://stackoverflow.com/questions/71292480

            QUESTION

            Pi4j to use java with raspberry Pi not working
            Asked 2022-Feb-08 at 13:23

            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:39

            Thanks 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;

            Source https://stackoverflow.com/questions/70400115

            QUESTION

            How do I convert a bipolar differential ADC value?
            Asked 2021-Dec-07 at 22:29

            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:29

            Updated 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!

            Source https://stackoverflow.com/questions/70176101

            QUESTION

            Pigpio permission bloqued for my actual user on Raspberry-pi
            Asked 2021-Nov-11 at 12:51

            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:51

            I tried this with the onoff library and it worked finally:

            Source https://stackoverflow.com/questions/69885347

            QUESTION

            How to change a variable properly with pigpio SetAlertFunc?
            Asked 2021-Nov-09 at 10:00

            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:00

            To my knowledge, there are three ways to store data 'beyond their scope'.

            1. A global variable - This variable is, as you know, shared across all calls and can be referenced even outside the compile unit.
            2. 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.
            3. 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:

            Source https://stackoverflow.com/questions/69895907

            QUESTION

            Unsure what to do with the CMake file from pigpio
            Asked 2021-Oct-29 at 18:24

            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:47

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

            Source https://stackoverflow.com/questions/69759904

            QUESTION

            Auto reload HTML image on each loop iteration in Python code using BottlePy
            Asked 2021-Aug-18 at 17:08

            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:12

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

            Source https://stackoverflow.com/questions/68822321

            QUESTION

            My custom node in node-red is unusable after dropped into flow
            Asked 2020-Nov-04 at 16:15

            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:15

            I suspect the editor expects your node to have a defaults property in its HTML definition, even if it's an empty property.

            Source https://stackoverflow.com/questions/64683640

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pigpio

            The pigpio C library is a prerequisite for the pigpio Node.js module.

            Support

            If you have a problem with the library, before you remove it from your code and start trying something else, please check the troubleshooting page first. Some problems are solvable and documented.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i pigpio

          • CLONE
          • HTTPS

            https://github.com/fivdi/pigpio.git

          • CLI

            gh repo clone fivdi/pigpio

          • sshUrl

            git@github.com:fivdi/pigpio.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link