Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c]

For questions pertaining to compiling C programs on the Raspberry Pi.

3
votes
1answer
34 views

AddressSanitizer on Raspbian

I am trying to use AddressSanitizer on Raspbian. I use the following to compile my program: gcc -fsanitize=address -fno-omit-frame-pointer -g prog.c -o prog Even for the simplest program (just a ...
1
vote
0answers
17 views

I want to know about printing NFC tag time out

I used libnfc and nfc-poll command. I get a UID and something else can I get a information about NFC tag time and print it out?
3
votes
1answer
170 views

Cross compiling for RPi - error while loading shared libraries

I'm trying to compile a simple program on my Ubuntu using the ARM cross compile toolchain (arm-linux-gnueabihf-gcc) and run it on my Raspberry Pi. The program is using the wiringPi shared library (...
1
vote
1answer
74 views

SPI sending function

I'm currently reworking a project from someone who graduated a few years back and I'm supposed to change the function of his work for a bit. I have trouble understanding these few lines from SPI ...
1
vote
3answers
91 views

Errors compiling C program with time.h library

I am facing some problems in my raspberry Pi 3 B+ when I compile this simple program that uses time library: #include <stdio.h> #include <time.h> int main(int argc, char** argv) { ...
0
votes
0answers
29 views

hcitool does not find devices despite GUI showing multiple

I'm trying to better understand C (and bluetooth) using a Raspberry Pi 3 b+ as the testing grounds. I started by writing a C program that uses BlueZ to scan for bluetooth devices (script pretty common ...
0
votes
2answers
53 views

Connecting multiple DHT11 sensors using WiringPi and C

For my internship I need to get measurements of multiple dht11 sensors and send them to a database using a REST API. I decided to go with WiringPi and C. I followed this tutorial: http://www....
0
votes
0answers
31 views

Converting C driver to NodeJS

I am looking for a bit of guidance. I am attempting to convert a Arduino LCD driver to nodejs. LCD:https://www.dfrobot.com/product-1737.html - spec PDF after bottom. I have researched I2C protocol, ...
0
votes
1answer
97 views

Programming Raspberry Pi Camera with C instead of terminal commands

Disclaimer: not so advanced here! Let me explain why I am looking for C code because the motivation itself maybe flawed. If I want to transport my Raspberry Pi project to the realm of customized ...
0
votes
0answers
61 views

Pigpio Wiegand timeout

I have an RFID keypad linked to my Raspberry Pi. It sends out a Wiegand 26 signal when someone presses a key or presents a card/fob. The code is based on http://abyz.me.uk/rpi/pigpio/examples.html I ...
2
votes
1answer
59 views

Generating fast rise PWM signals using software GPIO

I want to use my Raspberry Pi 3 Model B (rev 1.2) as a source for fast rise PWM signal generation. The idea is to utilize RPi as part of a cheap TDR (time-domain reflectometry) setup. For anyone ...
0
votes
0answers
62 views

GPIO Open drain and open source setting while using the pin as input

I found this document. It says: Open Drain and Open Source Sometimes shared signals need to use "open drain" (where only the low signal level is actually driven), or "open source" (where ...
0
votes
0answers
30 views

Generating multiple square waves simultaneously

I'm trying to generate 2 simultaneous square waves (50% duty cycle PWM signals) to step two stepper motors (STEP signal to separate motor drivers) on the Raspberry Pi Zero W. I use GPIO12 and GPIO19, ...
1
vote
1answer
103 views

How to access to I2C software with wiringpi library-

I want to use I2C software instead hardware I2C. Because a buggy parto of the I2C related with clock stretching. I can enable in boot.txt adding this: dtoverlay=i2c-gpio,bus=3 It would create a /...
0
votes
1answer
44 views

RaspberryPi getting error after reading some serial Input, using rs232 and C Language

my raspberry keep getting error after reading some serial input, like this: i'm using Library wiringPi with this sample code: #include <stdio.h> #include <string.h> #include <errno.h&...
1
vote
0answers
42 views

wine on exagear fail on libc6_2.19-18

have installed exagear but when wine try to unpack this still block me: for solving i try this on /bin/bash in the guest image /opt/exagear/images/debian-8: sudo dpkg -i libc6_2.19-18+deb8u10_i386....
1
vote
1answer
140 views

Imprecise result after bitwise operation on GPIO registers

I am using a Raspberry Pi(Model 1 B+) and an oscilloscope in order to program SPI with C. I am doing this by using direct access to the GPIO register. Like this: https://elinux.org/...
-1
votes
1answer
417 views

Showing an image on HDMI (DSI, HDMI screens connected)

I have a Raspberry Pi 3B device connected to a LCD '7 (7 inches LCD, its a touch screen I believe that's called DSI not sure) and also a HDMI screen. By default Raspbian considers the LCD as the ...
0
votes
0answers
100 views

Can't find c library for libxml2

I am trying to compile a C program that uses libxml2, it compiles OK (so the C headers are present) but the link fails with the message cc test.o -llibxml2 -lm -o test /usr/bin/ld: cannot find -...
0
votes
1answer
56 views

Blink doesn't work (code in C)

I am newbie to Raspberry Pi. Here is the script I want to see work: #include <stdio.h> #include <wiringPi.h> #define LED 0 int main (void) { wiringPiSetupGpio() ; // also tried ...
-1
votes
2answers
89 views

C Interrput every rsing edge 100kHz

i've a 100kHz signal and i want to detect every rising edge. I'm using ISR but edge isn't detected and when detected it's 46µs after the edeg. How to do? [EDIT] Here's the code with pigpio library: ...
0
votes
0answers
76 views

Decoding a 74HC595 Shift Register bus with GPIO

I'm trying to decode an existing serial Bus communication used to drive 74HC595 (Shift register). 74HC595 Bus lines are: Latch : (When falling edge data are acquireq by the shift register, when ...
0
votes
1answer
321 views

How to run a C program at boot time [duplicate]

I have a project and it is running a c program on the PI. The program is meant to start running at startup. So far I have tried to do this with rclocal, but this is depricated. Afterwards I tried ...
0
votes
3answers
57 views

Pi freezes after softPwm

I'm building a robot car as a beginner project with a Raspberry Pi 3 Model B. It was easily possible to control the motors with help of the wiringPi library in C. To adjust the speed of my car I want ...
0
votes
0answers
143 views

How to read data from PIR sensor which is controlled by relay i2c?

There are my first steps with RPi and i2c. I use expander pcf8574 and I would like to drive a relay to control LED and PIR sensor. When the state on sensor is HIGH, LED should be turn on. I wrote a ...
0
votes
0answers
326 views

How could I write a C function using the wiringPi SPI library to read the X and Y measurements from this 2-axis inclinometer?

How would one use the wiringPi SPI library (http://wiringpi.com/reference/spi-library/) to get the x and y readings from this SCA100T inclinometer? I understand that the function wiringPiSPIDataRW() ...
0
votes
1answer
270 views

Interface AD7193 with Raspberry Pi

I have been trying to interface an ADC with raspberry Pi namely AD7193 via SPI . For that I have enabled my SPI and installed spidev on my pi. but i dont know what to do next in order to get the ...
1
vote
0answers
507 views

How to Read LDR Input with Raspberry Pi's GPIO Pins in C? [closed]

Using an LDR and the below circuit diagram, I am trying to read the amount of light that the LDR is receiving. My primary goal is to detect a change when an object passes over the LDR to trigger an ...
0
votes
1answer
196 views

AVFrame YUV420P to dispmanx VC_IMAGE_YUV420

I'm using ffmpeg for decoding a video with h264_mmal encoder. And all test videos are in YUV420P color encoding. Also I'm using dispmanx for drawing frames from a video. Only problem which I have is ...
0
votes
1answer
278 views

Cross-compiling with nfs-mount as sysroot fails due to absolute links

I want to cross-compile C++-applications for the raspi using the rpi-tools, CMake and a raspbian sysroot I'm exporting via nfs from a running raspi. My CMake-toolchain-file is OK, header-files and ...
0
votes
1answer
692 views

Playing audio in C?

Every audio engine I've tried (SoLoud, cAudio, openal-soft) hasn't worked on my pi zero. I just want to be able to play audio in a program without too much hassle. I can use a system call like system("...
1
vote
1answer
2k views

Where is -lEGL -lGLESv2

I'm trying to install an OpenVG library, but when I start to make it I get the error. ... gcc -L/opt/vc/lib -lEGL -lGLESv2 -ljpeg -shared -o libshapes.so oglinit.o libshapes.o /usr/bin/ld: cannot ...
0
votes
1answer
432 views

Rotary encoder is giving less PPR reading

I am testing 400 PPR(Pulses Per Revolution) rotary encoder using code.I am rotating it by using the hand. I have connected Phase A and Phase B and also, ground and Vcc properly. The code is giving ...
1
vote
2answers
2k views

Size of serial port read size in c

I have a Raspberry Pi 3 and I'm currently use read(2) system call to read data from serial port. At this moment, I'm reading byte by byte from port with; rc = read(uart_fd, &byte, 1); I'm ...
3
votes
1answer
323 views

Does select/multithreading make sense when dealing with multiple DS18B20 and GPIO reads simultaneously?

As you may know, DS18B20 is not the quickest sensor and answers after around 750ms delay but, afaik, 1-wire is a relatively quick bus. I have multiple sensors connected to the board, which means if I ...
2
votes
1answer
390 views

How to run a persistent program at boot which prints to console?

I have program built for a drone project where my pi needs to start reading when the pi is booted up. I have substituted a simple C program instead call myloopprogram located at the root folder ~. It ...
1
vote
2answers
868 views

C library for controlling 16x16 ws2812b led matrix using Raspberry Pi

Where can I find a C/C++ library to control a 16x16 ws2812b led matrix using a Raspberry Pi? There exists a C code for Unicorn HAT HD here but the unicorn HAT HD uses four GPIO pins as data pins (pin ...
1
vote
0answers
3k views

PWM with wiringPi library and C in order to blink an LED at a given frequency

I am working with the wiringPi library with C on a Raspberry Pi 3 Model B and attempting to understand and develop a model so that I can predict the blinking behavior of an LED connected to GPIO #18, ...
1
vote
1answer
110 views

UART program on RPI 3 is not waiting for response

#include <stdio.h> // perror #include <sys/mman.h> // mmap #include <sys/types.h> // fd open #include <sys/stat.h> // fd open #include <fcntl.h> ...
1
vote
1answer
83 views

Magmatic sensor's error in MPU9150

I coded the following program to get the acceleration, gyro, and magnetic sensor values by using a MPU9150 that is connected to a Raspberry Pi 2 via I2C. I can get the proper acceleration and gyro ...
2
votes
1answer
489 views

Can GPIO mode be changed at once for more than one pin?

I'm currently trying to understand the pigpio library and I found it supports reading from and writing to more than one GPIO pin at once. However can it do the same with pin mode? I'm asking the ...
0
votes
1answer
225 views

Text overlay over video stream when saving to file system

I'am using raspberry pi zero as controller which communicate over UART with external board with five sensors. What I need is a way to save video stream from raspicam to filesystem with embedded text (...
2
votes
1answer
4k views

How to enable SPI1 and SPI0 at the same time?

I have installed a LCD screen that use my SPI0 bus and I2C but i want to connect my RFID reader to the same raspberry. My lcd screen can you see here: https://www.adafruit.com/product/1601 SPI1 will ...
0
votes
1answer
550 views

Wiringpi interrupts

If I make an interrupt and use a goto statement to go from the interrupt function to the main function will I start running into problems: with the flow of my program and with bugs. Will I start ...
0
votes
3answers
145 views

incorrect values shows up in ultrasonic output in a fixed position

I am using below code to get the distance from an ultrasonic sensor. when the sensor is pointed to the wall with no change in its position, after some correct values some incorrect values will show ...
0
votes
1answer
61 views

L293D wiring only works when 6v ground connected to 5v live

I have the following code which I use to run some DC motors on the Raspberry Pi with an L293D H-Bridge. I should be able to control which motor is driven and in which direction. #include <stdio.h&...
0
votes
2answers
262 views

PIGPIO PWM Unreliable

I have written a small C application to do PWM for some motors connected to a Raspberry Pi. I am using the PiGPIO library. The code as follows: int[] FWD = {MOTOR1_FWD, MOTOR2_FWD}; int[] BCK = {...
0
votes
2answers
161 views

An unknown error when programing with bcm2835 (i2c)

Forgive my broken english. I am using a RaspberryPI 3b+. I have written a program using the bcm2835 C library and I have found that none of my code worked. Even printf(). (there is no error when I ...
1
vote
1answer
1k views

glibconfig.h no such file or directory

I just installed glib in Raspbian(Debian version). I want to read a config file using glib. I am trying to write a C application in Codeblocks and I use the header #include <glib.h> But I ...
1
vote
1answer
150 views

Logic to print text in SSD1306

I was writing a program for my SSD1306 oled display from scratch without any third party. I have successfully initialized the display. But I dont know the logic to turn on the pixels for a particular ...