New answers tagged

0

I have created an extension on the Visual Studio Marketplace that will allow you to sync your project from your computer to your Raspberry Pi quickly. It currently has 900 installs and I have never received an issue or complaint. It requires minimal setup. In order to understand how the extension works, read the entire page here. The page will show you ...


1

You may need to run bash or sh before python in your crontab to read in the environment variables you want. Presumably at the moment you have something like * * * * * /path/to/script.py > /path/to/script.log 2>&1 Whereas something like this may help read in the .profile * * * * * /bin/bash -c /path/to/script.py > /path/to/script.log 2>&...


1

This is not a Raspberry Pi question. You should study the various techniques for passing data between programs: Sockets Pipes Shared Memory. I'm sure you can find examples written in Python.


0

If you get any readings at all it is probably wired properly. I suggest you try my DHT Python script. Leave the module with the name DHT.py and then issue the following commands in the same directory. sudo pigpiod python DHT.py x Where x is the (Broadcom) number of the GPIO connected to the DHT22 data line. https://pinout.xyz/


1

It is unclear what the video you reference says, but Raspbian configures the login shell using ~/.profile You can include extra environment variables in this file. NOTE this won't "hide" anything as it is readable by all users. # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/....


0

Ah, your hotel card might contain non ASCII characters, say Unicoded Chinese. So you need to decode the Unicoded Chinese characters each of which is denoted by two bytes. Of course hotel cards usually use other tricks to punish the bad guys trying to clone.


1

I know that this is a rather old question, but since I had the same problem I wanted to share my solution (apart from turning it off and on again, which also helped): list the processes which are using the resource and kill them. Two options are available for this: $ fuser /dev/ttyUSB0 If that returns nothing, try $ sudo lsof /dev/ttyUSB0 Then issue a ...


0

I would recommend 'syncthing'. It's not instantaneous but usually provides near real-time synchronization. More information at https://syncthing.net/ If you decide to install, the normal channel version tends to be a lower release so I recommend pulling from the syncthing repositories: Add "deb https://apt.syncthing.net/ syncthing release" to your ...


0

So I really do not think the issue is with your initial code at all but the real problem is in the way you designed the circuit as you should not connected all sensors to the same trigger pin but to different pins on microprocessor as each sensor can not catch it's own echo that way.


0

OpenWrt is a OS/tools that you can write on the SD-Card and run on your raspberry pi. In this link, you can find the image file and some explanation. It's easy to configure the OpenWrt. All you need is configure the eth0 or br0 (by default) as the WAN port and connect your modem port (internet) then share it by wlan0. It can be your simple firewall ...


2

GPIO.output(motorPins[i],((CCWStep[j] == 1<<i) and GPIO.HIGH or GPIO.LOW)) GPIO.output is a function which takes two parameters. The first motorPins[i] specifies the GPIO to act upon. In this case it is entry i in the array motorPins. The second ((CCWStep[j] == 1<<i) and GPIO.HIGH or GPIO.LOW) specifies the level to assign to the GPIO. If ...


1

You can install samba on the Raspberry Pi and open a network share. MS Windows devices are able to connect to it so you can just have your files on the share and work with them.


3

It's possible that this might mirror something I was doing a couple of years ago and I preface this with the observation that I don't believe that it was good practice, but I didn't find a way around it, so I welcome any correction. The issue (in my case) was that running a python program that accessed the GPIO pins required root access. If you are going to ...


1

Looking for this code to solve the problem: def capture_time(): d.real_time = time.strftime('%H:%M:%S') return d.real_time while True: capture_time() if d.real_time == '15:37:00':`


1

%l if not part of standard formatting for python but assuming you are on Linux it's: %l The hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.) (Calculated from tm_hour.) (TZ) Note: "single digits are preceded by a blank". So your string is " 3:37:00". I suggest ...


1

A little poking with Google suggests this is a permissions problem. I don't have an instance of Apache running on a Pi, but it runs as user www-data on Debian. If that's the case, try sudo adduser www-data gpio, reboot or restart Apache, and test.


0

If the pulses aren't very fast and you don't mind jitter you could do it in software. Untested Python. def send_PWM(GPIO, pulses, frequency, dutycycle): # dutycycle expected to be in range 0.0 to 1.0 duration = 1.0 / frequency on_period = duration * dutycycle off_period = duration - on_period for i in range(pulses): pi.write(GPIO, 1)...


1

Answer: Yes. There are several ways this can be done. The method used will depend upon the characteristics of the load connected to the relay's contacts. Background: As @OyaMist has stated, "the actual relay state may differ from its nominal state". From a distance, when the relay state must be known, we are reduced to making a simple assumption; i.e. "...


1

The error message you are getting says 'int' object has no attribute 'encode', the encode method is only available for objects of type str. I believe you want the str() function instead to convert the integer into a string (or byte array) that the write function can then use. You also mention (in the comments) that the Arduino side is only receiving the ...


2

Is you PI powered by your Mac? If so, sleep mode on the Mac should power off the PI. If this is what is happening, your answer is probably to obtain an independent power supply.


1

In general what you need to do is mock the Raspberry Pi specific libraries on your dev system. There are several ways to do this usually involving one of the following: Use the Python Mock library (unittest.mock) Manually update the sys.modules dictionary with the missing references Create your own local stub module (ie gpio.py) to provide the missing ...


0

I solved by installing this packages: sudo apt-get install sip-dev pyqt5-dev python-sip-dev pyqt5-dev-tools


1

sudo apt-get install python3-pandas works for me on Pi4 and pandas version is 0.23.3.


0

Issue solved by properly declaring the constructor.


0

I had tried this also using Pi Zero, my solution to the problem is to use OpenCV library. This will increase your frame rates because Opencv is written in C++ meaning faster speeds. Another solution is to use USB wifi to decrease latency.


1

/dev/spidev-x.y entries are only created for chip select pins which are hard-wired to the SPI module. There's only two of them and there's no way around that. What you could do is to connect CS pins to GPIOs which you would toggle from your userspace code: # Init spi.open(0, 0) # Use SPI device 0 GPIO_CSx = 18 # Pin you ...


2

The problem is that the swap file gets filled to 100% and then the Pi is frozen. If using a HDD you can increase the swap size to e.g. 1024. This works for me. Compilation occupies up to 170MB of swap on a Pi3.


1

I would suggest switching to ChromeDriver and using a package from the Raspbian repo as described here sudo apt-get install chromium-chromedriver


1

You should use a systemd unit file to start the python script on boot up and run it as service. Just create a new service with: rpi ~$ sudo systemctl --force --full edit monitor-db.service In the empty editor insert these statements, save them and quit the editor: [Unit] Description=Monitor Database changes After=multi-user.target [Service] ExecStart=/...


2

Answer Introduction I am a PCM1802 24-bit ADC newbie, never used it before. It is a complicated device and its operation needs a long explanation. For now, I am only trying to give quick and dirty short answers to the OP's couple of questions. I hope to give longer answers later. All newbies wishing to fully understand the answers given here, are ...


2

After changing the code it worked properly. So I updated here my code as it will definitely help a newbie. My device is ADAM-4520(485-232 converter), ADAM-4015(6-channel RTD module). I am interfacing these two devices with my Raspberry Pi 3 with serial (Rx/Tx)pin. import serial import time import struct s=serial.Serial(port='/dev/ttyS0', ...


1

2.7V is only partly relevant. Raspberry will detect anything above 1.6V as "High", so having 2.7V (with a closed switch) is no explanation for the malfunction. Still, you need to understand where that voltage difference of 0.6V come from: either you're measuring the wrong signal, or the actual schematic is different from what you've drawn. In both cases, ...


2

You have to install the SSL headers and libraries before compiling Python. Either install them using sudo apt install libssl-dev, or (cross) compile them from source. When running the Python configure script, check the output before compiling. It'll tell you what packages are missing.


1

I was having the same issue using python, Executing shell script in PHP etc so the solution is Enable python scripts on apache 2 using this guide: https://www.server-world.info/en/note?os=Debian_9&p=httpd&f=5 then go to: Application Menu > Preferences > Raspberry Pi Configuration > Interfaces > Enable Remote GPIO And then type the address to the ...


1

.bashrc is NOT intended to run scripts. It is run each time a non-login interactive shell is started and is used to configure the shell. ~/.bashrc: executed by bash(1) for non-login shells. There are many ways of running scripts, depending on what you are trying to do. See https://raspberrypi.stackexchange.com/a/47537/8697 for an example. (There are ...


2

You have not told us which sleep() function you are using. If you are using the one in the time module then it does support fractional times. https://docs.python.org/3/library/time.html#time.sleep time.sleep(secs) Suspend execution of the calling thread for the given number of seconds. The argument may be a floating point number to indicate a ...


1

Running different versions of python is not an issue of the hardware, means version of a Raspberry Pi. It is an issue of the version of the Raspbian distribution. A specific python version is integrated into the distribution with its shared libraries and tested that it runs there without dependency and version problems. Raspbian Stretch comes with python 3.5,...


Top 50 recent answers are included