gpio | Talk to your Single Board Computer 's gpio pins
kandi X-RAY | gpio Summary
kandi X-RAY | gpio Summary
This plain JavaScript module is generic and only rely on system's sysfs. Please consider other (more mature) gpio libraries out there which support better your hardware,. For instance, of you're looking for a reliable way to communicate with the Raspberry Pi using JavaScript, check out the wiring-pi JavaScript library. It provides direct bindings to the fully-featured Wiring Pi C library. But if you want/need a generic lightweight module, this one can be used as fallback.
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 gpio
gpio Key Features
gpio Examples and Code Snippets
Community Discussions
Trending Discussions on gpio
QUESTION
I'm doing a project where I need to monitor several hall sensors for a position encoding. The logic is pretty simple, but the digital signal is fast: it may have up to 350 position changes per second.
I was hoping I could simply write a hall sensor monitor program watching the GPIOs but it appears that these programs consume quite a bit of CPU if I monitor at the necessary frequency. I had hoped suspending the CPU between every poll would help, but it doesn't seem to make much difference.
Here's the polling loop from what I'm currently doing. It "works", but the CPU usage is far too high. I'm running this on a process that shares the "position" variable with other processes on a memory-mapped file.
...ANSWER
Answered 2021-Jun-13 at 15:12You're using wrong hardware & software for the job. Jetson Nano can be considered as a full featured PC. As I understand, it's suitable for high level algorithms, image processing and neural network evaluation. Bare metal programming does not make much sense for this kind of devices, hence you have Linux running on it. You need to be aware that in the presence of a non real-time operating system, you can't get reliable delay times.
Reading a quadrature encoder is low level task with strict hard real-time requirements. For this, you need microcontrollers (like PIC, AVR, ARM Cortex M), C/C++, bare-metal programming or an RTOS, and preferably dedicated hardware which is capable of reading quadrature encoders directly.
Polling input pins isn't the correct way of interfacing encoders. Keep it in mind that you need to poll the pins much faster than the expected pulse frequency. In microcontrollers, you use interrupts instead which saves you from polling. Even interrupts can't keep up with high resolution & fast turning encoders. When interrupts don't suffice, you need dedicated encoder interfacing hardware which counts pulses automatically for you.
The best thing you can do is picking a microcontroller and outsourcing the encoder counting job to it. As your encoder resolution is low, you don't need special quadrature interface hardware modules. You can just pick an Arduino and make it count pulses. Then your Jetson Nano can query Arduino using serial port, I2C or SPI to retrieve the up-to-date pulse count.
QUESTION
I just started programming a STM32 and generated a code with CubeMX for an SPI communcation with a gyroscope (L3GD20) I have a problem with the HAL_SPI commands.
I first try to read the WHO_AM_I
register which return a good response (0xD4)
Then I tried to do the same with CTRL_REG1
register and it was still good by returning (0x07).
But if I try to get both of them one after the other, the HAL_SPI_Receive
keeps sending the data of the first HAL_SPI_Transmit
of the code...
Tried to give it other buffers but still didn't work.
Here is the part of the code I'm intersted in :
...ANSWER
Answered 2021-Jun-11 at 10:26Since HAL_SPI_Receive
is already using HAL_SPI_TransmitReceive
(github stm32f4 spi driver) to send dummy data to generate clock, you can use that fact and ditch the HAL_SPI_Transmit
, and use the receive function like this:
QUESTION
I've taken a look at the device tree that is in use for a working i.MX6 based development board. I've noticed that in the case of the ethernet configuration, a confusing mix of directives are present. Namely:
- Node
fec1
contains a directive to delete nodemdio
- Node
fec2
contains a reference to nodeethphy1
- Node
ethphy1
is withinmdio
, the deleted node.
ANSWER
Answered 2021-Jun-11 at 10:18The /delete-node/ mdio;
directive is deleting the mdio
node that was added in imx6ul-imx6ull-var-som.dtsi or imx6ul-imx6ull-var-dart.dtsi.
OP pointed to imx6ul-imx6ull-var-som-concerto-board.dtsi as the source of the fragment. That is included by the following:
- imx6ul-var-som-concerto-board.dtsi
- imx6ull-var-som-concerto-board.dtsi
- imx6ulz-var-som-concerto-board.dtsi
One of those is included by at least the following, according to their imx6ul
, imx6ull
, or imx6ulz
prefix:
ims6ul
:
- imx6ul-var-som-concerto-board-emmc-sd-card.dts
- imx6ul-var-som-concerto-board-emmc-wifi.dts
- imx6ul-var-som-concerto-board-nand-sd-card.dts
- imx6ul-var-som-concerto-board-nand-wifi.dts
imx6ull:
- imx6ull-var-som-concerto-board-emmc-sd-card.dts
- imx6ull-var-som-concerto-board-emmc-wifi.dts
- imx6ull-var-som-concerto-board-nand-sd-card.dts
- imx6ull-var-som-concerto-board-nand-wifi.dts
imx6ulz
:
- imx6ulz-var-som-concerto-board-emmc-sd-card.dts
- imx6ulz-var-som-concerto-board-emmc-wifi.dts
- imx6ulz-var-som-concerto-board-nand-sd-card.dts
- imx6ulz-var-som-concerto-board-nand-wifi.dts
Those all include one of the following, according to their imx6ul
, imx6ull
, or imx6ulz
prefix:
imx6ul
:
- imx6ul-var-som.dtsi, which includes imx6ul-imx6ull-var-som.dtsi
imx6ull
:
- imx6ull-var-som.dtsi, which includes imx6ul-imx6ull-var-som.dtsi
imx6ulz
:
- imx6ulz-var-som.dtsi, which includes imx6ul-imx6ull-var-dart.dtsi
imx6ul-imx6ull-var-som.dtsi and imx6ul-imx6ull-var-dart.dtsi both contain this section:
QUESTION
ANSWER
Answered 2021-May-28 at 09:46As @JérômeLaban answered in the comment:
you can find the solution here: github.com/unoplatform/uno/issues/3813
QUESTION
I have a problem with memory violation problem that occurs if reach else if(argc == 2)
I'm trying to have a nice written script with no errors like that, anything else works like a charm...
Here's a code fragment:
...ANSWER
Answered 2021-Jun-08 at 10:26I followed @Yksisarvinen advice and reorder the code and now it works flawless:
QUESTION
I have a BeagleBone Black board and I'm using the below-mentioned image file. https://debian.beagleboard.org/images/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz
I aim to operate GPIO pins of this board with the c programming language.
To do so, I've gone through this link: https://beagleboard.org/static/librobotcontrol/installation.html
And after following all the steps according to this link the result I achieved is the same as mentioned in the checking functionality step [the last step] of this document.
Furthermore, I follow this document for c language setup: https://github.com/beagleboard/librobotcontrol/blob/master/docs/src/project_template.dox
and run this source code: https://beagleboard.org/static/librobotcontrol/rc_test_leds_8c-example.html
All these processes were completed without any error.
################################## Now I want to access the GPIO pins of the board. For that, I've prepared a basic code.
Let's take a pin P8_10 / GPIO2[4] for an example. So for that my code will be:
...ANSWER
Answered 2021-Jun-08 at 02:22Try config-pin gpio
QUESTION
I am running a main python program on a Windows PC that is hooked to equipment that cannot be ran on an Raspberry pi. At a certain point in the main program, I want to call/execute a Rpi program to run. I need the GPIO pins from the Rpi to turn on a relay/s. Is there a way to wirelessly(or serially) open and run the program on the raspberry pi from the main program already running on the Windows PC?
Maybe I am not thinking of something, is there an easier and just as cheap solution to turn on a relay from the Windows PC program?
Any points in the right direction would be greatly appreciated.
...ANSWER
Answered 2021-Jun-06 at 15:30depending on security requirements. Assuming that the Desktop PC and raspberry pi are on the same network, you could create an HTTP REST endpoint on the pi, you could use flask or fastapi for this. then call that from the app running on the desktop. for help with flask see https://flask.palletsprojects.com/en/2.0.x/ if you are familiar with python flask is fairly simple to get started with.
QUESTION
I know similar question had already been answered, and I studied dilligently. I believe, I have tried nearly all possible combinations, without success:
...ANSWER
Answered 2021-Jun-04 at 16:14You're running commands in the container as appuser, while the device files are owned by root with various group permissions and no world access (crw-rw---
and crw-r-----
). Those groups may look off because /etc/groups
inside the container won't match the host, and what passes through to the container is the uid/gid, not the user/group name. The app itself appears to expect you are running as root and even suggests sudo. That sudo is not on the docker command itself (though you may need that if your user on the host is not a member of the docker group) but on the process started inside the container:
QUESTION
I’m doing a home project with a raspi and a rain sensor.
Basically, with cronjobs, i run isitraining.py every 30 min.
If it is raining, i want it to increment a specific variable from another module (rains.water)
If it stops raining, i want it to decrease the same variable.
here are my codes:
rains.py
ANSWER
Answered 2021-Jun-01 at 22:32Every time testscript.py
runs, it's importing isitraining.py
fresh, from scratch, which then imports rains.py
fresh, from scratch. rains.py
and the water
value it holds do not persist across runs.
If you want to save the value, you need to manually write it to disk, then load it later when you want to use it. Something like this:
isitraining.py
:
QUESTION
I am using Linux 4.19.55 armv7l on a omap3 processor. On my target there is a usb modem that gets power from a gpio pin value (defined under /sys/class/gpio). There are occasions when I change the value parameter of this gpio pin to bring down the hardware and while doing so I frequently get an error (thrown by musb_handle_intr_disconnect from inside drivers/usb/musb/musb_core.c ) as under:
"musb_handle_intr_disconnect 843: unhandled DISCONNECT transition (a_idle)"
I tried debugging the issue by mounting debugfs and capturing data from the concerned bus by using usbmon. Bus id is identified from lsusb output and confirmed by observing /sys/kernel/debug/usb/devices. I observe that usbmon is unable to capture data whenever the mentioned error shows up. In a no error scenario the usbmon does capture the traffic from the concerned bus. Please help how to debug this issue.
...ANSWER
Answered 2021-May-31 at 08:09Just checked that a commit on kernel branch fixes this issue which is present inside the states handled by the glue layer. This is the required commit
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gpio
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