raspberry-pi2

Running a .py file in a loop

守給你的承諾、 提交于 2021-02-16 15:38:14
问题 I am currently trying to run a .py file but in a loop. Just for a test I am using I = 0 while I<10: os.pause(10) open(home/Tyler/desktop/test.py) I = I + 1 I am sure this is a very simple question but I can't figure this one out. I would also like to add in the very end of this I have to make this run infinitely and let it run for some other things. 回答1: There are a few reasons why your code isn't working: Incorrect indentation (this may just be how you copied it on to StackOverflow though).

Running a .py file in a loop

China☆狼群 提交于 2021-02-16 15:38:05
问题 I am currently trying to run a .py file but in a loop. Just for a test I am using I = 0 while I<10: os.pause(10) open(home/Tyler/desktop/test.py) I = I + 1 I am sure this is a very simple question but I can't figure this one out. I would also like to add in the very end of this I have to make this run infinitely and let it run for some other things. 回答1: There are a few reasons why your code isn't working: Incorrect indentation (this may just be how you copied it on to StackOverflow though).

Executing a Python file from Codeigniter

。_饼干妹妹 提交于 2021-02-08 04:12:01
问题 I have some trouble to execute a Python file from a Codeigniter controller's function. ~/application/controllers/Lights.php : header("Access-Control-Allow-Origin: *"); class Lights extends CI_Controller { public function __construct() { parent::__construct (); $this->load->helper ( array ('url', 'form') ); } public function turnOn() { system('sudo python test.py > /dev/null 2>/dev/null &'); } } but when I try to execute a system call, like : system("sudo gpio mode 15 out"); this works

Executing a Python file from Codeigniter

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-08 04:08:55
问题 I have some trouble to execute a Python file from a Codeigniter controller's function. ~/application/controllers/Lights.php : header("Access-Control-Allow-Origin: *"); class Lights extends CI_Controller { public function __construct() { parent::__construct (); $this->load->helper ( array ('url', 'form') ); } public function turnOn() { system('sudo python test.py > /dev/null 2>/dev/null &'); } } but when I try to execute a system call, like : system("sudo gpio mode 15 out"); this works

Cannot cross-compile Qt 5.7 for Raspberry PI because it “requires a C++11 compiler”

你。 提交于 2021-02-07 19:56:25
问题 I want to cross compile qt5 on RPi2 according to this RaspberryPi2EGLFS when I want to configure in step7 I see this error and I don't have any idea how to solve it. . . collect2: error: ld returned 1 exit status Makefile:91: recipe for target 'c++11' failed make: *** [c++11] Error 1 C++11 disabled. ERROR: Qt requires a C++11 compiler and yours does not seem to be that. Please upgrade. I use antergos x64. 来源: https://stackoverflow.com/questions/38232461/cannot-cross-compile-qt-5-7-for

How to compile OpenCV with OpenMP

淺唱寂寞╮ 提交于 2021-02-07 09:10:28
问题 A user in this SOF post suggests building OpenCV with a WITH_OPENMP flag to enable (some) multi-core support. I have tried building OpenCV-2.4.10 with OpenMP but I am unable to then import cv2 in Python. Note: I am able to build and use OpenCV-2.4.10 in Python. The problem is building with the WITH_OPENMP flag. I am replacing lines 49-58 in opencv-2.4.10/cmake/OpenCVFindLibsPerf.cmake , as suggested in this blog post, with the following: # --- OpenMP --- if(NOT HAVE_TBB AND NOT HAVE_CSTRIPES)

How to compile OpenCV with OpenMP

匆匆过客 提交于 2021-02-07 09:08:26
问题 A user in this SOF post suggests building OpenCV with a WITH_OPENMP flag to enable (some) multi-core support. I have tried building OpenCV-2.4.10 with OpenMP but I am unable to then import cv2 in Python. Note: I am able to build and use OpenCV-2.4.10 in Python. The problem is building with the WITH_OPENMP flag. I am replacing lines 49-58 in opencv-2.4.10/cmake/OpenCVFindLibsPerf.cmake , as suggested in this blog post, with the following: # --- OpenMP --- if(NOT HAVE_TBB AND NOT HAVE_CSTRIPES)

How to pass I2C addresses to Adafruit CircuitPython code? (Running ADS1115)

梦想的初衷 提交于 2021-01-28 11:42:42
问题 I'm trying to run two Adafruit ADS1115s off of one Raspberry Pi, using two I2C addresses (0x48, 0x49). The address for each device can be set by tying the ADDR pin high (0x49) or leaving it floating (default, 0x48). I've confirmed that each board works when the address is set to 0x48, and running "i2cdetect 1" confirms that both boards are connected at the correct addresses. I can successfully run this sample code My question is this: How do I get the code to read from I2C address 0x49

Raspberry pi 2 and BMP280 : Slave address was not acknowledged

社会主义新天地 提交于 2021-01-27 12:18:10
问题 I follow the project WheatherStation on https://www.hackster.io Windows IOT. I downloaded project on github and connected my BMP280 sensor on Raspberry. You can check my connections on http://kdamerval.fr/WeatherStation/1.jpg http://kdamerval.fr/WeatherStation/2.jpg For me, it's correct, but i have an exception with bmp280.WriteRead(WriteBuffer, ReadBuffer); System.IO.FileNotFoundException: The system cannot find the file specified. Slave address was not acknowledged. 回答1: There are a couple

Raspberry Pyusb gets Resource busy

不打扰是莪最后的温柔 提交于 2020-12-31 04:47:31
问题 I'm trying to connect my Raspberry PI to Pic4550 via USB. (Pic function is ok with windows c# program!). So I have installed rpi 2, pyusb, and tried to communicate with the help of [https://github.com/walac/pyusb/blob/master/docs/tutorial.rst][1] I get connected to the USB device, lsusb shows: Bus 001 Device 006: ID 04d8:0080 Microchip Technology, Inc. The python prog finds the device! Gets the right config but cannot write message: usb.core.USBError: [Errno 16] Resource busy I tried to run