Hot answers tagged

15 votes

Raspberry as an I2C SLAVE

Since this topic is very poorly covered and Sebastião's snippet and helped me to solve this problem I want add a complete solution on how to setup a RaspberryPi right here (tested on a RPi 3 and Zero ...
LinusCDE's user avatar
  • 151
13 votes

How to install GNU C++ Development Tools on Raspberry Pi (using apt-get)

To install development tools on raspbian : sudo apt-get install build-essential
Henry Todd's user avatar
11 votes

Can I run TensorFlow on the Raspberry Pi?

There's now a python package available for Tensorflow on RaspberryPi aptly called, tensorflow-on-raspberry-pi.
Christopher Hooper's user avatar
9 votes
Accepted

C++ cout output on RPi 3B

ostream class has no methods to print volatile pointers, and a volatile pointer cannot be converted to a regular pointer without an explicit cast. However, any pointer can be converted to bool: every ...
Dmitry Grigoryev's user avatar
7 votes
Accepted

Raspberry as an I2C SLAVE

This is almost identical to your previous question. You probably should have edited that rather than asking a new question. You need the bscXfer to be within the while loop. That is how the xfer ...
joan's user avatar
  • 70.4k
6 votes
Accepted

Installing Raspberry Pi Cross-Compiler

The primary target of the Ubuntu arm-linux-gnueabi cross compiler is to compile for a different architecture of the same Ubuntu release leveraging the Debian/Ubuntu multiarch capabilities. Example: ...
Matthias Lüscher's user avatar
6 votes

Installing Raspberry Pi Cross-Compiler

I cannot reproduce the problem anymore As of https://github.com/raspberrypi/tools/tree/5caa7046982f0539cf5380f94da04b31129ed521 it just works no matter which directory I'm on, just adding to PATH is ...
Ciro Santilli OurBigBook.com's user avatar
5 votes

RPi-bluetooth headless communication with android phone - no pairing

Alright, I found a solution to my own problem. I post it here in case of somebody running into the same problem. I am using bluez and installed libbluetooth-dev to get the necessary libraries for the ...
Mattie's user avatar
  • 127
5 votes

How to enable SPI1 and SPI0 at the same time?

In order to use the spi1 port of the Raspberry Pi, you need to set the dtoverlay=spi1-1cs in /boot/config.txt. By default this will use the pins (https://pinout.xyz/pinout/spi): MOSI - pin 38 MISO - ...
steviethecat's user avatar
5 votes
Accepted

Running Modern Opengl on raspberry pi

Assuming your running the latest Raspbian Stretch with Desktop. To enable OpenGL, from a terminal window: sudo raspi-config Select 'Advanced Options' Select 'GL Driver' Select 'GL (Full KMS)' ...
CoderMike's user avatar
  • 6,727
5 votes

WiFi packet sniffer for RPi in c++

Sniffing other WiFi networks you are not associated must be supported by the WiFi chip, called monitor mode. If you look at the chip configuration on the RasPi with: rpi ~$ iw list Wiphy phy0 --- ...
Ingo's user avatar
  • 41.7k
4 votes
Accepted

C++ compatibility

if I compile code on a 64 bit PC, will it work on the Pi? No -- as per other answers, C++ is a purely compiled language, meaning it goes straight from source to machine code, which is architecture ...
goldilocks's user avatar
  • 58.3k
4 votes
Accepted

Can I use, in a friend function, an object created in class constructor?

I am a bit rusty on my C++ (it's been 15+ years) but I think the issue is that you didn't declare the mpu variable as a private (or protected) member of the class. Instead it only gets a declaration (...
Phil B.'s user avatar
  • 5,033
4 votes

libstdc++ Error: `GLIBCXX_3.4.22' not found

It appears you used a g++ 6 cross-compiler (default install on Debian 9?) then attempted to run the resulting binary on Raspbian 8 Jessie. You can see gcc's symbol versioning guide here where g++ 4.9 ...
jdonald's user avatar
  • 2,884
4 votes
Accepted

Raspberry Pi 3 and V4L2 C++ Capture Code for JPEGs

We have a case of a program that runs without error on some cameras (such as mine), but gives an error specifically with Raspberry Pi Camera Module V2. We can track this down starting with the dmesg ...
jdonald's user avatar
  • 2,884
4 votes

Cross compiling from Fedora 27

Try installing: sudo dnf install binutils-arm-linux-gnu gcc-arm-linux-gnu glibc-arm-linux-gnu binutils-arm-linux-gnu contains the GNU binutils for the arm-linux-gnu target. gcc-arm-linux-gnu ...
Paul's user avatar
  • 47
4 votes
Accepted

sqlite3 cannot find -lsqlite3

To be able to link an SQLite3 program you need the libsqlite3 (run-time) and libsqlite3-dev (development) libraries installed. Install those with sudo apt install libsqlite-dev (which will pull in ...
Dougie's user avatar
  • 5,251
3 votes
Accepted

How do I set the input focus to my SDL2 app?

Make sure you have libudev development files installed. sudo apt-get install libudev-dev Then, rebuild and reinstall SDL 2. Mouse/keyboard input started working for me after I did that.
Josh's user avatar
  • 46
3 votes

Importing a C++ code in Python

You can call C modules from Python (after all the reference Python implementation is written in C). As to the question "will i be able to import C in it?", the answer must be no. If you had the ...
joan's user avatar
  • 70.4k
3 votes

Getting data from C++ app to LAMP stack

Should I set up a RAM disk, or is there a more direct way for the data to make its journey? In this context RAM disks have been superseded by tmpfs, which is simpler to use and probably already ...
goldilocks's user avatar
  • 58.3k
3 votes
Accepted

Getting data from C++ app to LAMP stack

Since you are already running a LAMP server, I would write the data to your MySQL database, where it can be read via PHP and displayed. The MySQL website has example code for writing to a MySQL ...
Steve Robillard's user avatar
3 votes
Accepted

Increasing fps of pi camera using OpenCV C++ implementation

As suggested in the comments, I think you need to set the frame geometry first and then set the frame-rate afterwards. std::cout <<"\t[PARAM_FRAME_WIDTH] "; if(!cap.set(CV_CAP_PROP_FRAME_WIDTH,...
Mark Setchell's user avatar
3 votes
Accepted

Use c++ on raspberryPi3

I don't use an IDE. I write my C++ code using a text editor vim and that works very well for me. With that said, however, I've used some IDEs recently, and I'll present a few alternatives and some ...
Edward's user avatar
  • 951
3 votes
Accepted

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

For asynchronous or polling access, the better approach is to serialize your hardware access into a single thread for a given bus. This thread should run at relatively high priority and establish the ...
crasic's user avatar
  • 2,973
3 votes
Accepted

pigpio spiXfer in C++

Using a char type to hold bytes is fairly common in C. char is one of the basic C types and holds one byte. Here is some C code to read channel 0 of the MCP3008. The example should make clear how ...
joan's user avatar
  • 70.4k
3 votes

Can't access GPIO pins directly from C++ with wiringPi

You cannot mix "direct register access" with code using GPIO libraries. You have to select one method and stick to it fom beginning do end, no matter how painful it is. A good example of direct ...
flakeshake's user avatar
  • 6,195
3 votes
Accepted

Pi 3B+ jack audio inputs and low latency

I can confirm, after having used the Bela shield on top of a Beaglebone Black, that its latency is extremely low (<1ms) and quite capable of doing calculations on audio. The normal shield has 2 ...
ZeroZ30o's user avatar
  • 213
3 votes
Accepted

Files not saving even with flush

You can try adding sync to the mount options in /etc/fstab: PARTUUID=11eccc69-02 / ext4 defaults,sync,noatime 0 1 ^^^^ ...
goldilocks's user avatar
  • 58.3k
3 votes
Accepted

Problem with gcc/g++ versions

In the main guide says Now you have the needed compiler, but it is not yet set to be the default compiler. You can fix that using the instructions here. If you read the link, it says that after you ...
GramThanos's user avatar
3 votes

How to get 10-bit depth black and white image from raspicam v2.1?

From picamera.readthedocs.io, 5.11. Raw Bayer data captures : Bayer data consists of 10-bit values, because this is the sensitivity of the OV5647 sensor used by the Pi’s camera. The 10-bit values ...
Ephemeral's user avatar
  • 2,147

Only top scored, non community-wiki answers of a minimum length are eligible