Hot answers tagged

13

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


11

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


8

That may depend on your distro, but if you are using raspbian, the stock gcc includes g++, here's the version info: me@RPi» gcc -v Using built-in specs. [...] --enable-languages=c,c++,fortran,objc,obj-c++ So apt-get install gcc should work if it isn't already there. Most distros will build gcc with C++ support, so this should be true for them too. The ...


8

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


7

It doesn't have to be given a specific extension, you can name it anything - it just has to be executable in order to run: chmod +x program_name ./programm_name I checked on my RPI and it looks like executable permissions is set automatically by g++, so you might be missing the './' bit before the program name you are attempting to run if you are in the ...


7

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


5

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


5

__int128 is not part of the standard. Even if a compiler supports it, it's bad style to use it directly that way. Identifiers starting with two underscores, or an underscore and an uppercase letter, are by definition reserved for the compiler / library, i.e. the identifier alone tells you "back off, dude, this is not for you". In the header <cinttypes>...


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

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.


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

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


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

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

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


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


3

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

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 jack microphone inputs and 1 jack stereo output. Strictly speaking, you have to buy the version that comes with jack adapters, though. I do believe more inputs/...


3

You can try adding sync to the mount options in /etc/fstab: PARTUUID=11eccc69-02 / ext4 defaults,sync,noatime 0 1 ^^^^ This should be faster than calling it from userspace all the time. Unlike commit, which reduces the amount of time something can be cached before writing, ...


2

I have used SDL 1.2 on the Raspberry Pi with Raspbian, by installing the libsdl1.2-dev package that lenik suggests. It also works from the console, so X is not needed. The only special thing with running from the console on the Raspberry Pi, is that you have to check the supported screen size and then initialize your screen with wathever values you get. See ...


2

If you are using USB Serial Converter, make sure it is capable of keeping signal level at 12V. Cheap USB to serial dongles may not have proper level shifting and keep signal at USB signal level, which is only 5V. It makes signal reception unstable, similar to what you are seeing.


2

MONO doesn't run a file with third party libraries like opencv .I just udated my c++ file using cross compiling (MinGW) on eclipse to be able to run it on linux and I compile the .cpp file on the pi.


2

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


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