You're not actually re-checking GPIO4, you're just re-reading the variable mag1.
One way to fix this would be to add mag1=GPIO.input(4) after your time.sleep(20).
import RPi.GPIO as GPIO
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
I've found the answer !
Why this only execute once was the 301 answer (permanent redirection) the browser have memorized ! So, to avoid it, i've put a simple html redirection.
from datetime import datetime
from threading import Condition
from http import server
from time import sleep
Thanks to you, i've made this, i try to make the same thing as you (take a snap from a stream to save a picture).
I thought about stopping the stream, taking the picture and going back to stream via another URL. It has worked once but no way to make it work a second time...
I've added some functions to manage the camera to the server.
For the GPIO input i ...
You were almost there with your command. After you download the package, run the following command:
python3 setup.py install
That is how you install a package (you were missing the install at the end).
If you have no internet access, you will need to solve the dependencies by hand (i.e., install ALL the packages required), so you will need to do a bit of ...
I had the same issue and it was just that the webdriver I had installed was for linux and when I changed it to ARM webdriver ( a bit older version ) it worked.
The webdriver I used was: https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-arm7hf.tar.gz.
Also follow this blog and selenium automation will work smoothly for you....
Thanks. This is the final code I wound up using in case anyone else has a similar question.
pi = pigpio.pi()
def cbf(gpio, level, tick):
cb1 = pi.callback(21, pigpio.FALLING_EDGE, cbf) # FALLING_EDGE, RISING_EDGE, or EITHER_EDGE
y = 1
y = y + 1
The pigpio term is callback.
def cbf(gpio, level, tick):
print(gpio, level, tick)
cb1 = pi.callback(22, pigpio.EITHER_EDGE, cbf)
cb2 = pi.callback(4, pigpio.EITHER_EDGE)
cb3 = pi.callback(17)
cb1.cancel() # To cancel callback cb1.
There is also wait_for_edge but I would prefer callbacks.
I wrote my own (limited) version of Lirc in Python, it can send IR codes and can be controlled via TCP (just like Lirc). I use it with an Android app, to control my amplifier.
You can find the source and instructions on https://github.com/amfasis/lyrc
Looking at the error message, you probably don't have the correct permissions. Try adding privileged: true to your docker-compose.yml file (or something like --privileged=true if you are using docker run).
(I assume there was a typo when you posted your command. To test, it should be raspistill -o test.jpg.)
If you want to skip loading the desktop, I would suggest not using the .xinitrc route, but replace loading the session with your own program.
Create ~/.xsessionrc with one line
Create ~/.Xsession with whatever you want to start. You might want to throw in a few lines to avoid screen blanking and screen savers:
xset s off ...
When you are executing a script from /etc/profile, it is running in a terminal context, not a display context.
To run a script whenever the window manager initializes, edit your ~/.xinitrc, and add your script.
For example nano ~/.xinitrc, and add python3 /home/pi/test.py.
Well, i was "closed-in-to-just-one-posibility" -or not thinking clear-
The MFRC522-Python lib "Read.py" cannot be executed without sudo AND the chromium-browser CANNOT BE EXECUTED as SUDO, so...
Afters a lot of Coffee and hours i found that i can execute the Read.py as SUDO and inside of it, the web browser directly with another username
basicly i have ...
First of all, your script should exit with code 1 if it fails. So systemd will stop to execute the script and does not waste performance for nothing.
You are right with you assumption that you do not match the environment to run the script. You have to know that systemd does not provide an environment by default. That is by definition to always have a ...
Here's a new solution using a resistor and a FET to parallel multiple RC522 RFID readers. I tried UART interface without success, and I2C is too short range. Using SPI code from https://www.raspberrypi-spy.co.uk/2018/02/rc522-rfid-tag-read-raspberry-pi/.
IRQ is a RC522 output that stays low while an RFID is in the antenna's near field. I used this signal ...
So there are two types of buzzers, active and passive. Passive buzzers are the ones on which you can control the frequencies, thus making it ideal for coding songs. An active buzzer has only one frequency, and normally has a water proof coating at the bottom. When you want to make different sounds I would recommend using a passive buzzer. It doesn't exactly ...
There are all sorts of reasons why one side might turn faster than the other. Unless there is an obvious problem turning the wheel by hand there is probably nothing wrong with the motor.
The normal approach would be to vary the amount of power you send to each motor by changing the PWM dutycycle. Provide a higher dutycycle for the slower motor.