I do this all the time. Two-way communications works just fine.
Yes I keep my ports open continuously. UNLESS I am running the IDE. The IDE requires that I not have any other programs trying to use the same serial port.
The code I use on the Arduino to open the port is much more simple than you're showing.
Idle 2 is installed but on recent Raspbian images Python v2 menu entries are disabled.
To activate it start the 'Main Menu Editor' from the Preferences menu.
Select 'Programming' on the left. After activating 'Python 2 IDLE' you should be able to start Idle 2 from the menu.
You may need to install the 'Main Menu Editor' program. For this use e.g.
sudo apt ...
You say you are using raspbian-stretch. With this and with most debian derivate you have python 2.7 installed. This is because the Debian operating system itself needs this version for its scripts to run. It is for historical reasons and because the maintainers haven't got it to upgrade all OS scripts to Python 3. I think they will do by time. If you call ...
You have two bottlenecks here that are going to slow you down. First, there's the SPI, which was mentioned in a comment. That takes a few clock cycles in each direction and will limit you some. The second is writing to the SD card. I expect that the second is more important for your speed. Disk writes are generally much slower than computations, and the ...
Python installations generally do not share modules between them. Modules installed for Python 2 will not be shared with the Python 3 installation (they are stored in different locations, etc).
At least for now, python and pip refer to the Python 2 versions of the toolchain. As such, most Python tools have a Python 3 equivalent. If you used
sudo pip ...
Machine: Intel 80386
This shared library object (.so) was compiled for the x86 instruction set, used predominantly on 32-bit PC style computers with Intel or AMD processors. All Raspberry Pi models use some variant of ARM, which is common in mobile devices. They are not compatible.
You either have to get the source code and ...
You have a few options:
Assign the two Pi's static IP addresses and connect them using an ethernet cable. The Pi Foundation has a series of lessons on doing this.
Create a WiFi access point on one of the Pi's.
Use a pair of USB to TTL devices like this one and connect their rx and tx pins (rx of one to the tx of the other). This tutoriual uses a console ...
Removing Python is not a minor issue the resulting problems can lurk unseen for a long period of time only to bite you later (e.g. a missing library that was uninstalled and not reinstalled breaks a seldom used feature). As a result, I think you would be better off backing up the important files you mentioned using SCP and starting over, by reimaging your SD ...
First in raspi-config select Boot Options then Desktop/CLI then Console Autologin.
Then in a Terminal window run:
sudo nano /etc/profile
At the bottom add:
sudo python /home/pi/yourscript.py
Press ctrl+X and then press Y followed by ENTER twice.
/home/pi/ is the directory of your python file and yourscript.py is the name of your python code.
To check ...
Finally I discover that the problem it was not the code. The problem was an indentantion error imperceptible in Sublime Text. I only can see this problem opening the code with nano editor. The solution was select all the code (ctrl+a) and then click on the "Tab Size:" message on the right-bottom corner of Sublime Text interface and select "Convert ...
When you write "\n" in a C program, the compiler replaces it with a single character. The \ is called an 'escape', and it gives a special meaning to the character following it -- in this case the n.
Commands sent to the devices must be terminated with a suitable line ending, so it knows where the command ends. Common line endings are \n (which is a single ...
The Pi has 2 UART, but only ONE is accessible via GPIO. This is accessible as /dev/serial0 (but needs to be enabled via raspi-config).
The change you propose to config.txt will not do what you think.
You can disable bluetooth and/or swap which UART is connected to the GPIO, but there seems to be little reason to do so - the default is adequate for most ...
I would suggest you to use Aspose.Cells Cloud SDK to convert XLSX to PDF.
Have a look on short example:
#set file name
filename = "input.xls"
outputfilename = "output.pdf"
#upload file to aspose cloud storage
#convert file to pdf
response = cellsApi.PostDocumentSaveAs(name=filename, body=body, newfilename=outputfilename)...
I used the imagemagick module. I originally downloaded it to convert jpg the pdf. Just on a whim I tried it.
os.system('sudo convert file_name.xlsx file_name.pdf')
It will kick a few errors in the shell, and creates a folder for it name "_dername", not in the directory I specified, and give it a weird name that starts with "magick-", followed by some ...
Honestly, I don't think 60 fps is achievable, even on a Pi 3. While the Pi 3 is fast for a Raspberry Pi, the processor is still only 1.2 GHz. That said, you could do a few things to help and see if it is achievable with some optimisation; OpenCV itself is in C++ which won't experience such large performance problems as Python does.
You can check to see what ...
This type of system information on Linux is often available through D-Bus so I listed all of the D-Bus connections with time in them:
pi@raspberrypi:~ $ busctl | grep time
:1.1 359 systemd-timesyn systemd-timesync :1.1 systemd-timesyncd.service - -
Fixed this problem.
I was running under python 3 but oauth2client and gspread were installed under python 2. To fix this, I ran pip3 install on gspread and oauth2client and all is running smoothly now.
Here is how you can do to remote debug python scripts on pi from eclipse (windows):
Install eclipse and pydev
Install pydevd on pi using pip install pydevd
In eclipse, create a new python project and add below lines at starting of the code:
import sys;sys.path.append(<path to pydevd>)
import pydevd;pydevd.settrace(<ip address of windows>, port=...
You haven't told the system that you want to run a Python script. It probably assumes the script is a bash shell script.
You have a number of choices.
use the form python RUNME.py
add a shebang as the first line of your RUNME.py script. I use #!/usr/bin/env python
For choice 2 to work you need to ensure the script is executable with
chmod +x RUNME.py
As @Millways has pointed out in his comment, using rc.local is probably not the best way to do this. You should try something else. There are two alternatives (maybe more); I'll describe one of them here; the one I feel is the simplest and easiest:
Start your crontab editor as follows:
Add the following line to your crontab file:
If it runs on the command line you can use a systemd Unit file to define exactly the same environment you have on the command line. You can find some examples here on the site how to do it. One example to start the chromium browser you can find at execute Python file on Systemstart. Just modify the line ExecStart= in the Unit file to call your kiosk program ...
The standard release of RPIO does not support the Pi Zero, Pi2, or Pi3.
You will need to build RPIO from the github of RPIO version 2.
Go to that github choose Clone or download and select Download ZIP.
Then do the following on the Pi where you saved the ZIP.
sudo apt-get install python-dev python3-dev
A "segmentation fault" is your program trying to violate its memory space. It sounds scarier than it is--nothing really got broken. If a debugger is unavailable to you, simply put in additional print(...) statements to pinpoint exactly where your segmentation fault is. Adding print() statements sounds silly but is surprisingly effective. Put one after each ...
This is a common automation problem with a range of solutions from the last century or so - essentially, what you are working with is the inverted pendulum.
What you probably want to do to make this project a lot easier is to transform your axis so that you try to solve this problem instead:
I'm not sure what you're expecting from an answer here because I have done a similar project for my dissertation at university and that was 6 months work.
What you need to look into is a motor controller algorithm (such as PID control) which creates a feedback loop based on the current speed of the motor and the difference between the gyroscopes current ...
Thank you all for your advice on my question. Based on the suggestion by user name joan, I did some research and ended up going the route of making a batch file to the correct directory. I am leaving the exact way that I did this here, for anyone else who runs into a similar issue. Thank you again to all.
Create batch script (yourscript.sh file) in /home/pi ...
Refering to this and I would simply do:
wget http://packages.namniart.com/repos/namniart.key -O - | sudo apt-key add -
sudo sh -c 'echo "deb http://packages.namniart.com/repos/pi wheezy main" > /etc/apt/sources.list.d/libcec.list'
sudo apt-get update
sudo apt-get install python-dev build-essential libcec-dev cec-utils
and then finally install with pip: