Here is some Python I used to test the reliability of software serial. The input side is fairly trivial. You just make the appropriate bit bang serial open calls in Python or C. The output side is more involved as you have to use waveforms to construct the bit stream.
The code here is using 7-bit rather than 8-bit data. The test was written at about the ...
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 W)!
Setting up a working slave:
Be sure to have commented out this line in your /boot/config.txt:
Next, install g++...
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 pointer value is true except for NULL which is false. This was done to support code which used pointers as conditions, e.g. if(p) use(p);. This implicit ...
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: You compile on Ubuntu 16.04 amd64 for Ubuntu 16.04 armel.
If you would like to do a similar thing for Raspbian I suggest the following approach:
On your Ubuntu ...
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 structure is updated with new information.
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 enough:
git clone https://github.com/raspberrypi/tools
Assuming your running the latest Raspbian Stretch with Desktop.
To enable OpenGL, from a terminal window:
Select 'Advanced Options'
Select 'GL Driver'
Select 'GL (Full KMS)'
To test it's working you can install and run glxgears - a graphical demo that should run at close to 60fps:
sudo apt-get -y install mesa-utils
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
--- snip ---
Supported interface modes:
 @Ghanima's answer is way better than this one, go check it !
You could use cron and add an @reboot task:
Running crontab -e as root or sudo crontab -e will allow you to edit your cron.
will execute that script once your computer boots up.
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 specific. Or it might be more accurate to say once compiled into an executable that executable is stored as machine code; when it is compiled I believe it ...
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 C++ code.
I used the code for the rfcomm-server.c from the example https://people.csail.mit.edu/albert/bluez-intro/x502.html.
After copying the code, I ...
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 (and I'm not sure that's done in the right way, my (Java-influenced) brain says you should likely do MPU6050 mpu = mpu(A); to make the correct declaration) in ...
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 error:
Jan 06 01:40:20 raspberrypi kernel: bcm2835-v4l2: Failed to enable capture port - error -28. Disabling camera port again
Error 28 (ENOSPC) is "No ...
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 contains GCC set up for cross compiling to ARM — but note that "Only building kernels is currently supported. Support for cross-building
user space programs is not ...
The problem was that protobuf installs protoc by default in the /usr/local/bin directory, as opposed to /usr/bin.
Therefore, when I called ./configure with the --with-protoc=/usr/bin parameter, the location was wrong.
SOMEHOW unbeknownst to me, I had an older version of protoc (2.4.0) installed in /usr/bin, so the ./configure didn't complain (maybe this ...
you should get ANY library working on your hardware setup to make sure you have wired your thing the right way. usually libraries include sample code, that could be run with minor modifications only, like changing pin numbers.
after you made sure your hardware is setup properly, you may try to convert C code to your C++ project, basically by adding .C files ...
OK. Some good questions here. I'll try to take it in order since that's the easiest way to answer, but it may make the text a bit rambling.
As far as I know there isn't an inbuilt package for the GPIO other than the Python GPIO package. However, WiringPi has been packaged for easier installation. It hasn't yet been included into Rasbian. I think it will be ...
So people,not best answer though but this could help for those who have problem with me.
Try use gnublin API.Haven't do a deep research yet but seems considerable (it's also compactible with Python)
but for those who still want to give me reccomendation,i'll wating for it.
You can setup a cross compiler for Rasberry Pi in Ubuntu by following the steps in https://stackoverflow.com/questions/19162072/installing-raspberry-pi-cross-compiler
Then you need to create a new entry to use this cross compiler in Code::Blocks.
From the Settings menu, select Compiler.... In the Global compiler settings copy an existing compiler. E.g. ...
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 needed level of knowledge you would have known the answer to the question.
I'd say you will need a fairly advanced knowledge of Python and some familiarity with C ...
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 existent on whatever OS you are using, presuming it is a GNU/Linux variant. To check:
mount | grep "^tmpfs"
Chances are it includes /run, which is world readable, ...
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 database from C++.
This has one big advantage over a RAM disk or tmpfs it persists the data across restarts, allowing for long term storage and analysis.
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 ties to GLIBCXX_3.4.20 and g++ 6 to GLIBCXX_3.4.22.
What can I do to get that 3.4.22 version installed on the Pi?
Perhaps the most straightforward approach ...
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 thoughts on each.
Yes, you can run Eclipse with CDT to develop C++ code on a Raspberry Pi. However, I find the C++ support and Eclipse general ...
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 "time-base" for your application control loop
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 register access, from the author of pigpio:
I hope you now understand why pigpio and WiringPi exist in the first ...