C is a general-purpose computer programming language used for operating systems, games and other high performance work. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.

learn more… | top users | synonyms

0
votes
0answers
9 views

Use a PIR sensor to detect motion and activate a piezo speaker

Im trying to write the code for a program that will use a PIR sensor to detect motion and then trigger a piezo speaker. I was following this tutorial https://pimylifeup.com/raspberry-pi-motion-sensor/ ...
0
votes
1answer
25 views

Why did my code not stop when the command line closed?

I was running some C code that drove a stepper motor. The general flow was that it would take user input for the number of steps, maximum speed, and acceleration (scanf commands). Then it would go ...
1
vote
1answer
95 views

WiringPi code issue resolved

Resolved. Thanks for all the help.
1
vote
0answers
29 views

WiringPi traffic light in C [duplicate]

I am working on a project for my C programming class and need to use wiringPi on my raspberryPi. I need to create a traffic light (like a real one- red to green to yellow to red, etc.) and a ...
1
vote
2answers
48 views

python library to generate pulse frequency of “n” hz

I'm trying to make a function which would output a pulse frequency , given a Ts (time.sleep(ts) on my function) The function is for later use on an acceleration ramp for a stepper motor , as the ...
0
votes
1answer
33 views

Write interrupt data into a Raspberry pi Register on C?

I'm trying to read interrupts and detect direction of interrupts from an encoder using a raspberry pi , it is USdigital Brand "H6BM-1000-500-IE-S-H" , it has 1000 signals per revolution , the thing ...
-2
votes
0answers
37 views

I2C initialization using C

I want to know how the initialization of I2C is done using C-code.Kindly help what are all the libraries required and provide appropriate sample code for accessing the register values of EEPROM.
0
votes
1answer
32 views

C Program compilation problem [closed]

I wrote a program using nano and tried to compile it using gcc command on Lx-terminal. It's showing stray error. Can anyone tell me what is the problem? For simple "hello world" program also is ...
1
vote
1answer
26 views

Is Raspbian signal(2) handling persistent or non-persistent?

I've been looking at the signal handling in a library I am using in a project of my own {Joan's pigpio as it happens} but having read the Raspbian man pages for signal(7), sigaction(2) and finally ...
0
votes
0answers
114 views

Raspberry Pi 2 B HX711 Load Cell Amp Issue

I am working with a Raspberry Pi 2 B. I am trying to get load readings from a load cell like (uxcell Electronic Balance Weighing Load Cell Sensor) through a HX711 load cell amplifier (following a ...
3
votes
2answers
40 views

Polling GPIO pin from C, always getting immediate response

I'm using C to read the GPIO pins from /sys/class/gpio. I have a separate thread that I'd like to get notified when a pin changes value, so I'm opening the file for read, then calling poll() on it, ...
0
votes
1answer
31 views

NXP XTRINSIC-SENSE-BOARD using C

https://www.element14.com/community/thread/37836/l/reverse-engineered-sensorso-with-source https://github.com/larsch/rpi-mems-sensor Hello Everyone :) I have a raspberry V1 and a NXP senseboard, ...
0
votes
1answer
32 views

What does libcofi do?

This answer rather vaguely states "libcofi-rpi.so is a hack to speed up certain memory operations." Apart from the fact that the file is called libcofi_rpi.so on my machine, what exactly is libcofi ? ...
0
votes
0answers
40 views

Reading the MCP3304 over SPI in C with WiringPi

I wish to use the MCP3304 ADC with the RPi 2B to read a potentiometer. I have some basic understanding of how SPI works: namely, that to read from the chip I need to send it one bit every time it ...
1
vote
2answers
115 views

Controlling a common RC car

I need to test my computer vision stack written in C++ on a mobile robot and I need to control the robot from a Linux ARM board (which can be a Raspberry Pi). Since the specialized wheeled robot ...
0
votes
0answers
52 views

getnameinfo() always rises “Illegal opcode” error from Valgrind

I have a Raspberry Pi 2, running Raspbian. I'm trying to get informations by IP addresses, such as aliase(s), hostname(s) and so on. According to the man, gethostbyaddr is obsolete: better use ...
1
vote
0answers
57 views

Using INT interrupt line on PCF8574 I2C 8-bit IO-expander on Bit-banged RPi GPIO?

I am planning to use a triplet of RPi GPIO pins as an additional bit-banged I2C bus on my RPi. This will be run at a lower than typical rate (and level-shifted via a 3.3 to 5.0 V I2C shifter unit) so ...
3
votes
1answer
46 views

Configure Alt GPIO using sysFS

I have a Model B Revision 1.0 + ECN0001 that I am making a program in C to read and control a HCTL-2022 Quadrature Decoder using the GPIOs by way of sysfs. It's working great, but now I would like to ...
0
votes
1answer
149 views

Cross Compile Error Using arm-linux-gnueabihf-gcc

I am trying to cross compile a C binary from Ubuntu Trusty Tahr x64 to Arch Linux ARM on my Raspberry Pi Zero. Here is my hello-world.c code: #include <stdio.h> int main(int argc, char ...
0
votes
0answers
25 views

TLC5940NT library for Raspberry Pi in C

I've been trying to make TLC5940NT work with my Raspberry Pi, but everything I tried didn't help me light any LED - hence I think that I am not able to communicate with the chip. The first thing that ...
3
votes
1answer
74 views

Any tutorials for the 10Dof DfRobot IMU? ADXL345 - HMC5883L - ITG-3205 - BMP085

I would like to connect this Imu to the Raspberry Pi via I2C. I am looking for a C/C++ or Python code to use the data provided by this imu. It integrates the ADXL345 accelerometer, HMC5883L ...
3
votes
2answers
189 views

I2C using wiringPi or IOCTL in C, more than 2 bytes

I'm willing to send 20 bytes at a time to Arduinos via I2C bus. I'm writing a C program (that will become a Daemon) that should achieve this, and thus I downloaded via Git the last wiringPi library, ...
4
votes
2answers
609 views

GPIO library for C

I want to utilize the GPIO pins on my Raspberry Pi 2, but I'd rather not use Python since I personally dislike the language. However, I cannot seem to find any information regarding the use of C, only ...
0
votes
1answer
73 views

Sequential Control - time and signal based in C

i want to program in C a simple sequential control with the raspberry. The current task is: If a button is pressed, something (e.g. a LED) shall be switched on for 5 seconds and then go off itself. ...
0
votes
0answers
65 views

Kernel Module Driver using GPIO PIN as Input

I am beginner in C programming. I want to make kernel module and user space program based on Raspberry Pi GPIO for input data on GPIO pin X. I don't want to use other library e.g. broadcom or ...
5
votes
1answer
234 views

Using BCM GPIO pin numbers with wiringPi C library

I'm a GPIO newbie experimenting with getting my Raspberry Pi to blink an LED with C using the wiringPi library. The example code at http://wiringpi.com/examples/blink/ (blink.c) compiles perfectly and ...
0
votes
0answers
118 views

help with OpenCV on Raspberry Pi 2

I have installed OpenCV 2.4.9 and 3.0 on my Raspberry pi 2. I have done everything as he said in this tutorial https://www.youtube.com/watch?v=_DMqGTsEo30 . But in the end of video he want to start a ...
3
votes
1answer
124 views

Serial connection Arduino - Pi

I am having an Arduino Nano sending "48" or "49" via a serial connection to a Pi. I'd like to use this input, but for some reason the connection always cuts out after a few seconds with the following ...
1
vote
1answer
95 views

How to make the DHT11 sensor work with direct memory access(dev/mem method)?

So, I'm trying to make the DHT11 sensor work without any library on a Raspberry Pi 2 using C. I'm using this tutorial to manipulate the GPIO pins registers so i can set them as input,output, HIGH and ...
1
vote
0answers
62 views

How to make the DHT11 sensor work with the sysfs gpio manipulation method?

So i am trying to connect a DHT11 sensor to my Raspberry Pi 2. My wiring is correct, since i got it working with the wiringPi library. Since i don't want to use someone else's library I've created ...
0
votes
3answers
838 views

Serial Communication C/C++

I was wondering if its possible to communicate between Arduino ann RPi using Serial Communication in C/C++, it's possible with python but didn't find a suitable library for C/C++ ?
3
votes
2answers
156 views

How to set Raspberry Pi GPIO pins to input or output using clean C?

How can access the GPIO pins in C without writing to the sys/class/gpio directory, in a way that would allow me to create my own interface? I would like to end up able to do something like this: ...
4
votes
1answer
132 views

How to display graphical text without X using C?

Using the Raspberry Pi 2 with the official 7" touchscreen, I want to display some high quality text without using an Xorg server. I'm looking for APIs that provide simple functions such as: ...
3
votes
1answer
284 views

How do I read the GPU temperature in C?

I am making a graph on the temperature using a NTC resistor and also by reading the CPU temperature, however I'd also like to read the GPU temperature. I read this answer explaining briefly how to ...
0
votes
2answers
88 views

How to continiously monitor Wiegand readers using pigpio library?

How do I need to modify the C example from http://abyz.co.uk/rpi/pigpio/examples.html for continious monitoring of Wiegand readers? I need to run it as background process. For now I have a code: ...
0
votes
0answers
80 views

Mouse Events for Omxplayer in Raspberry Pi

My mouse cursor always gets hidden when I play videos through Omxplayer. For my codes written in Gtk-2 C, I have found a solution as key-events which when pressed quits or kills omxplayer. But I ...
0
votes
0answers
32 views

Cross Compilation Delay in Live Streaming

I have designed a Glade file and written codes in Gtk2, C language in Ubuntu(local host) to play live streaming of cameras, I cross compiled with the Raspberry Pi(remote host)...everything went fine, ...
0
votes
0answers
56 views

Raspberry Pi to Roomba communication serial port

I'm developing a program in C where I want to communicate a Raspberry Pi with the roomba robot by the serial port, and I've got some problems. First of all, I have the source code where I connect to ...
1
vote
1answer
335 views

How do I access the Wii Nunchuck using WiringPi

The Wii nunchuck is an I2C accessible device and can be wired to the I2C pins of a Pi. How do I read the data from a Wii nunchuck in C using the WiringPi library?
2
votes
1answer
642 views

softPwm of wiringPi for servo … where is the problem?

I have a Python code which controls an ESC & servo fine. Now, I'm trying to develop a similar code in C language using wiringPi. However, the C codes don't work. The Python & C codes are ...
3
votes
1answer
436 views

BMP180 allow to read calibration but fail to read data

I have BMP180 connected to my RPi, I can read calibration data from it, but when I try to get pressure / temperature data -- I get 80 00 for temp and 80 00 00 for pressure (mean -- 'just-after-reboot ...
1
vote
0answers
85 views

Is it safe to read/write register values without Data Memory Barriers?

I'm trying to utilize the BCM2835's BSC/SPI slave peripheral to use the Pi as an effective I2C slave, however I've been running across some segmentation faults when I try to write to the configuration ...
1
vote
2answers
128 views

Not able to fetch register values using Mike M's BCM2835 C code

I'm attempting to utilize the bcm2835_peri_read(uint32_t*) function from Mike M's BCM2835 code, however console-output-debugging indicates I'm continually getting back my address. I'm using g++ on ...
0
votes
0answers
792 views

SunFounder Raspberry Pi CPU/RAM Display Mini LCD 84*48 PCD8544 Shield For Model B+/B

this display is driving me nuts! i almost tried all available samples/libraries. the only one i got working was this one https://github.com/ronanguilloux/Raspberry-Pi-Utils all the other ones ...
1
vote
1answer
168 views

Python script always throws exception the first it is ran after reboot

I am trying to build a home automation system with Raspberry Pi connected to Arduino Uno via USB. Everything works but the Python script that I am using for reading variables from Arduino is always ...
2
votes
1answer
635 views

How to compile OpenCV software on Raspberry?

I want compile an OpenCV program on Raspberry, the problem is that I didn't figure out how to do so. I installed OpenCV following this guide. $ pkg-config --modversion opencv 2.4.1 OpenCV can be ...
2
votes
3answers
271 views

How to create an GPIO event loop with C (Or Objective-C)?

I made a board that attached a 1602 LCD and three buttons to the GPIO pins of the Pi. Now I need to write a software to go with it. The software runs under Raspbian. The software need to interrupt ...
5
votes
3answers
471 views

How can I get a clock in C accurate enough to control a servo?

I want to write a program that controls a servo motor myself using a pi B+. Controlling the motor involves sending 1.5 millisecond pulses along a GPIO pin every 20 milliseconds. I have tested the ...
1
vote
0answers
268 views

BCM2835 Event Detection

I've got 2 motors, 2 encoders, a motor controller, and my B+ wired up. My B+ is running Arch with kernel: Linux drd 3.12.35-1-ARCH #1 PREEMPT Tue Dec 23 07:14:51 MST 2014 armv6l GNU/Linux. The 2 ...
1
vote
1answer
91 views

How to use headerfile from diffrent libraries in same code

In raspberry pi , we got two famous libraries (a) bcm2835 and (b)wiringpi. So,I want to use some header files from library bcm2835 and some from wiringpi in a same code. Is it possible to do so. If ...