Questions tagged [c++]
For questions pertaining to compiling c++ programs on the Raspberry Pi.
257
questions
0
votes
0
answers
22
views
Why is digitalRead/digitalWrite not working in C++ nor in gpio terminal commands?
I'm writing in C++ using WiringPi to integrate with GPIO but it doesn't seem to work during runtime.
Below I have a simple example of an output wired to an input expecting the input to read HIGH, but ...
1
vote
2
answers
191
views
One time timer interrupt? (Pico W, C/C++)
Is there a way to set a one time timer interrupt on the Raspberry Pi Pico? I.e. in code, I would be able to tell the hardware timer to interrupt me in a specified period of time. Example pseudocode ...
0
votes
1
answer
467
views
writing my own libcamera-app
I used to be quite an experienced c programmer but, just after cpp appeared, we all switched to java. Now I am rather lost with make, cmake, ninja, git, pip3, meson ... It makes dealing with java's ...
0
votes
0
answers
133
views
How to use libwiringPi.so for cross compiling using CMake?
I'm trying to use CMake to cross compile a C++ code using the Wiring Pi library but I'm having trouble with making CMake to find said the correct library. Since I'm compiling from x86 to ARM in order ...
1
vote
1
answer
199
views
ADC and PWM strange behaviour
I'm trying to measure the voltage of a 11.1V LIPO battery, which is substituted by a power supply for testing, using the raspberry pi pico on a breadboard, and then it changes the voltages of an RGB ...
2
votes
1
answer
71
views
Does Raspberry Pi Pico C/C++ SDK Setup Script work on Raspberry Pi Desktop installed on a PC?
The Raspberry Pi Pico documentation indicates "if you are intending to develop for Pico on a Raspberry Pi, then you can set up the C/C++ toolchain quickly by running our setup script from the ...
3
votes
0
answers
144
views
Assistance with pigpio SPI slave bscXfer on Raspberry Pi 4
I am trying to write C code so my Raspberry Pi4 can be an SPI slave, and the SPI master can read data from the Pi4.
I'm expecting to get this data from SPI master (in a continuous loop):
0x01 0x42 ...
2
votes
0
answers
77
views
How do I turn an brushless dc motor 1 cycle per second using pigpio and c++
I am using an esc and a bldc and im trying to slowly spin my bldc
I can get my motor to spin with
gpioServo()
but when I use
gpioPWM()
It just continues to beep
when i use
gpioServo()
it spins way ...
0
votes
0
answers
564
views
OpenGL on a 64-bit Raspberry Pi 4 without X
I wrote a 3D visualization program in C++ called ahrs-visualizer back in 2012 for a 32-bit Raspberry Pi, basing my code on the official OpenGL example code that came with Raspbian. It does not ...
0
votes
1
answer
755
views
Control a dc motor with pigpio
I wanted to control a DC motor with pigpio in C++. I have first of all written a simple Python program for this, where I still use RPi.GPIO. For this you can find many solutions how a DC motor could ...
1
vote
1
answer
148
views
Raspberry Pi Thermal Printer Flow Control DTR or XON/XOFF
I use Rpi Zero 2 and Adafruit Nano Printer (link) for Bitmap printing. I ported the C++ Adafruit Thermal Printer library (link) for my Rpi Cpp program, which was pretty straightforward, but I am ...
1
vote
1
answer
1k
views
libgpiod read value Operation not permitted
Trying to read the values from gpio chips in a Python script using the gpiod python module. When calling get_value() we are getting "Operation not permitted".
Have tried running the python ...
0
votes
0
answers
96
views
RPi Pico + Arduino IDE: Compiler generates FPU instructions for a device without an FPU
I've bought a SSD1306-compatible display for my Raspberry Pi Pico. However, it uses some kind of non-standard encoding and the typical Adafruit libraries don't work. The seller says I should use the ...
0
votes
1
answer
2k
views
wiringPi compile issue on RPi 4B 64bit
I am trying to compile my C++ project using CMake. My Raspberry Pi OS does include /usr/include/wiringPi.h and all the required .so files in /usr/lib/. Here is the output of gpio -v command:
gpio ...
2
votes
1
answer
2k
views
Using Motor Encoders with Raspberry Pi
I am trying to read a quadrature motor encoder with the Raspberry Pi. After attempting to write the code in Python, I came to the conclusion that Python was too slow (which was expected). I tried to ...
0
votes
1
answer
186
views
OpenCV setting resolution results failing in reading frames
I've tried to change the resolution on raspicam v2 with my raspberry pi 4 b, but this code gives me false every time I try to read frame... Is there anything I am missing? I can easily read frames ...
0
votes
2
answers
80
views
How can the x-tools C++ crosscompiler build code, which does not use the Pi's FPU?
After starting over with the x-tools C++ crosscompiler to build my Raspi apps, I found out that the app runs considerably (approx. 1/3) slower than when built with the g++ (version 6.5.0) on the Raspi....
0
votes
0
answers
234
views
How to use 4 CS for SPI in C++
I'm currently trying to implement 4 CS in RaspPi. I'm still a newby in this field and used the library wiringPi. For CS0 and CS1 this works totally fine.
However now I have 2 more CS on the GPIO Pin ...
0
votes
1
answer
172
views
Cross Compilation of Qt OPC UA Server on Raspberry Pi 4B fails
currently I am trying to cross compile a stand-alone Opc Ua Server on a Raspberry Pi4B with Qt 5.15.2 and the Qt Opc Ua Plugin. For Cross Compilation, I used this instruction: https://wapel.de/?p=842.
...
0
votes
0
answers
58
views
RPI not recieving I2C master's messages
Im trying to use a RPI3B+ to emulate a WiiMotion Plus, So i have it set up as a slave using pigpio and connected to a wiimote.
Expected outcome: The wiimote will try to read from register 0xfe and ...
1
vote
3
answers
382
views
How to start GPCLK2 pin inside code of C/C++
I would like to use GPIO 6 (GPCLK2) to produce a 8.192 MHz clock in other words i would like to use its alternate function of a general purpose clock, but im having trouble looking for a guide that ...
0
votes
1
answer
2k
views
How to read any connected DS18B20 temperature sensors with C/C++
I'm new to the Raspberry Pi ecosystem so pardon me if I'm talking nonsense.
I want to read the temperature data from the connected DS18B20 sensors using C/C++.
I followed this schema to connect them:
...
0
votes
1
answer
923
views
Raspberry Pi Auto-start Executable with Systemd, Loaded but Inactive (Dead)
I am trying to run a CPP client application to connect to a server when Raspberry Pi is booted and connected to the Internet. I validated this CPP executable (Asio_Client_Main) works fine when ...
0
votes
1
answer
2k
views
How can I make an app linked against GLIBCXX_3.4.26 run on Raspbian Buster, which only offers 3.4.25?
I'm now trying to compile C++ apps for my Raspi 3B by using crosstool-ng on my OpenSuSE-based host machine. The toolchain now works fine, but when trying to run the app on the Raspi, I always get this ...
4
votes
1
answer
1k
views
How to directly render pi camera output to display using C++
Right now, I'm building an application and one of the sub goals is to display the camera to the screen with a good resolution and frame rate. I'm also trying to keep the cpu usage as low as possible ...
0
votes
1
answer
627
views
Changing the code for the "Waveshare" e-paper display
I've put together quite a nice little ePaper display clock with the Raspberryp Pi Zero W running Buster. I'm using the Waveshare 6" kit (display and controller board).
Has anyone here had any ...
0
votes
0
answers
356
views
Visual Studio Code - output to "integrated Terminal" is corrupted / unreadable
the Unreadable text output from the 'integrated terminal' is shown below this line:
xecutinga isk:C /+/++C a++ ltndv suinfc <ndc < tarrangb ulnd.... flnd. fngnhec. hlcchhflddy
i am new to ...
0
votes
1
answer
72
views
NRF24L01 PRX only datapipe 0 and 1 receiving data
I'm creating a project in C++ on a raspberry pi zero and C on PIC18F26Q10 where multiple PICs will transmit sensor data to the raspberry pi.
Both devices can send and receive data to and from each ...
2
votes
1
answer
1k
views
How to control a Servo via libgpiod on a raspberry PI
I am trying to control a Servo in c ++ using the libgpiod library.
My problem is in defining the 50Hz pwm pulse on the pin that the servo is connected to.
The servo signal cable is connected to pin 33 ...
0
votes
1
answer
101
views
Camera, splitter and encoder in OpenMAX
I want to access camera and get both encoded and not-encoded video from it in my C++ application. As I'm targetting Raspberry Pi Zero, I want it to be as efficient as possible, so I decided to use ...
1
vote
1
answer
1k
views
How to write a C++ wireless communication to control my raspberry pi over network
I have a raspberry pi and I want to convert it into a RC car which I will control through my PC. I know C++ programming and I intend to use that to write the software stack. I want to create a C++ ...
2
votes
4
answers
2k
views
Install OpenCv in a raspberry pi 3 with c++
I've been working on a project with OpenCV and Visual Studio but I want to perform some tests on a Raspberry Pi 3, I haven't found accurate information about how can I use OpenCV in a Raspberry Pi ...
1
vote
2
answers
598
views
Run application with other user than root
Within a small project I opened a wireless connection using the NRF24L01 transceiver and a Raspberry Pi 3 Model B+ with Raspbian 10. To communicate over the transceiver I make use of the RF24 library ...
3
votes
1
answer
501
views
I want to build "raspberry pi " c++ code in desktop ubuntu
I have created simple c++ application program in raspberry Pi. I could build this code in raspberry pi, but I'm getting error while compiling it in my labtop "ubuntu".
My aim is to create executable ...
2
votes
1
answer
238
views
Comparison between Object Detection Solutions on Raspberry PI
I have only little experience with embedded systems. I have a Raspberry Pi 4 with 1gb RAM and a Camera Module v2.1 and want to do object detection and tracking on it. By best solution I mean a ...
2
votes
2
answers
2k
views
WiFi packet sniffer for RPi in c++
We are currently working on a project, where we want to see the packets sent over WiFi. We are using an RPi zero w as a sniffer, and we have managed to use ioctl calls to get ssid and other ...
0
votes
1
answer
2k
views
Open (lx)terminal on startup, run program in it
I have the following service:
[Unit]
Description=Create test directory
After=graphical.target
[Service]
Type=oneshot
RemainAfterExit=yes
User=pi
ExecStart=/home/pi/Desktop/startup-script.sh
[...
2
votes
2
answers
1k
views
How to run a script after bootup on RPi 4/Raspbian 10 (buster)
Im trying to run a script after bootup, when the desktop is shown. The script is rather simple:
#!/bin/bash
mkdir /home/pi/Desktop/test
So in other words:
This script is creating af folder "Test" ...
1
vote
1
answer
1k
views
What resolutions can I use for the Raspberry PI camera 2? And how can you tell?
I'm working on a project with Raspberry Pi 3 and camera module v2.
I'm using OpenCV and raspicam.
I want to know the maximum resolution I can use. The datasheet says 3280*2464, but I get errors when ...
3
votes
1
answer
1k
views
How to get 10-bit depth black and white image from raspicam v2.1?
I am a little bit confused about image capturing by Raspberry pi camera V2.1 [1]. I work on the Raspberry pi 4 and I know how to get 8-bit depth black and white (BW) image from it on the C++ level ...
0
votes
0
answers
151
views
Poor std::atomic performance on Pi 4
I recently migrated a project of mine from Pi 3B+ to Pi 4B only to find that it now runs much slower than before. After investigation, it appears the culprit is the atomic library that I use heavily. ...
0
votes
0
answers
287
views
C++ programming - Class for Motor rotation and control for washing machine embedded system device layer error?
#include <iostream>
using namespace std;
int main()
{
// declaring variables:
int MotorControl;
int MotorRotation;
MotorControl = on;
MotorControl = off;
// process motor control and ...
1
vote
0
answers
277
views
How to update GTK3 image using a button to capture a picture from the camera using C++?
I managed to create a program that will display some buttons and and Image. Now I would like to update the image when a button is clicked. How do I do that?
Here is what I have so far, it all works ...
2
votes
4
answers
2k
views
Cannot run 2 apps with rc.local but it works from command line
I have 2 apps, lets call them /home/pi/app1 and /home/pi/app2
If I type into console sudo /home/pi/app1 & sudo /home/pi/app2 both apps execute without issue
When I add the same line to /etc/rc....
1
vote
1
answer
2k
views
OpenCV Gstreamer pipeline doesn't work on Pi 4 Buster
I'm studying about object tracking and detecting in Gazebo Simulation. So, I'm trying to send Simulation video(Gst Plugin) to Raspberry Pi 4 via ethernet cable over UDP stream. And Pi 4 side, catch ...
0
votes
2
answers
2k
views
Raspberry Pi 4 B g++ undefined reference to boost::system::system_category()
I created a simple program in C++ on my RPi to test the Boost library. This is the code:
#include <iostream>
#include <boost/asio.hpp>
int main()
{
std::cout << "Hello World!" &...
0
votes
1
answer
815
views
Duplex communication via bluetooth - in C++ code [closed]
I have a working C++ code , partially converted to class, passing single (text char ) message form client (Rpi) to server (PC).
I have used a composite ( fancy work for hack ) of many C/C++ code ...
0
votes
1
answer
613
views
polling gpio raspberry 2 doesn't work
i'm writing a library for my raspberry pi 2 for gpio control.
I'm trying to test a function for read a gpio driven by interrupts with sysfs but i can't do that my function stops in poll() function.
...
1
vote
0
answers
156
views
pigpio library dependencies missing when compiling Radiohead nRF24 library
I am using Eclipse 2019-06 CDT to compile the Radiohead nRF24L01 library (v1.97) using the pigpio interface (v71) with C++. I get the following errors:
rpi/rfs_pizw2/usr/lib/libpigpio.so: undefined ...
2
votes
0
answers
122
views
g++ and gdb debugging does not provide full backtrace
I never experienced this behaviour on classic desktop platform thus I'm asking here.
The question is how to correctly debug C++ application (g++ build) using GDB on Raspberry Pi? When my application ...