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 ...
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>&...
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.
python DHT.py x
Where x is the (Broadcom) number of the GPIO connected to the DHT22 data line.
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 ~/....
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.
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 ...
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 ...
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.
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 ...
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.
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 ...
%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 ...
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.
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):
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.
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. "...
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 ...
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 ...
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.
/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:
spi.open(0, 0) # Use SPI device 0
GPIO_CSx = 18 # Pin you ...
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.
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:
Description=Monitor Database changes
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 ...
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.
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, ...
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.
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 ...
.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 ...
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.
Suspend execution of the calling thread for the given
number of seconds. The argument may be a floating point number to
indicate a ...
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,...