Hot answers tagged

16

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 ...


14

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: Preparations Be sure to have commented out this line in your /boot/config.txt: dtparam=i2c_arm=on Dependencies Next, install g++...


11

To install development tools on raspbian : sudo apt-get install build-essential


11

There's now a python package available for Tensorflow on RaspberryPi aptly called, tensorflow-on-raspberry-pi.


9

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[0]);. This implicit ...


6

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 ...


6

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.


5

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 export PATH="$(pwd)/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:${PATH}" printf '#...


5

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)' Then Reboot 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 ...


5

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 --- snip --- Supported interface modes: * IBSS * managed * AP * P2P-client * P2P-GO * ...


4

This looks exactly the same as this issue: https://github.com/raspberrypi/linux/issues/766 Fixed four days ago.


4

[edit] @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. Add this: @reboot /path/to/script will execute that script once your computer boots up.


4

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 ...


4

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 ...


4

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 ...


4

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 ...


4

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 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 ...


3

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 ...


3

Try ldconfig -p | grep libmmal. On raspbian you should get: libmmal_vc_client.so (libc6,hard-float) => /opt/vc/lib/libmmal_vc_client.so libmmal_util.so (libc6,hard-float) => /opt/vc/lib/libmmal_util.so libmmal_core.so (libc6,hard-float) => /opt/vc/lib/libmmal_core.so libmmal_components.so (libc6,hard-float) => /opt/vc/lib/...


3

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 ...


3

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 ...


3

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.


3

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. ...


3

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 ...


3

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, ...


3

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.


3

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 ...


3

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. Eclipse Yes, you can run Eclipse with CDT to develop C++ code on a Raspberry Pi. However, I find the C++ support and Eclipse general ...


3

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 In pseudo-code while(running) write_long_delay_device write_dev1_cmd read_dev1_data write_dev2_cmd ...


3

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: http://abyz.me.uk/rpi/pigpio/code/minimal_gpio.zip I hope you now understand why pigpio and WiringPi exist in the first ...


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