New answers tagged

2

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 import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(18,GPIO.OUT) GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) mag1=GPIO.input(4) if mag1: ...


0

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. import picamera from datetime import datetime import io import logging import socketserver from threading import Condition from http import server from time import sleep PAGE="""\ &...


0

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 ...


1

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 ...


0

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....


0

Thanks. This is the final code I wound up using in case anyone else has a similar question. import pigpio pi = pigpio.pi() def cbf(gpio, level, tick): print("Button pressed") cb1 = pi.callback(21, pigpio.FALLING_EDGE, cbf) # FALLING_EDGE, RISING_EDGE, or EITHER_EDGE y = 1 while True: y = y + 1 print(y)


0

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) print(cb3.tally()) cb3.reset_tally() cb1.cancel() # To cancel callback cb1. There is also wait_for_edge but I would prefer callbacks.


1

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


1

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.)


0

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 STARTUP= Create ~/.Xsession with whatever you want to start. You might want to throw in a few lines to avoid screen blanking and screen savers: #!/bin/sh xset s off ...


0

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.


0

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 ...


2

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 ...


0

As the output complains about "No access to /dev/mem", you could give access to the user running the script: sudo chown pi /dev/mem If your user is not pi, change the user name.


0

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 ...


0

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 ...


0

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.


0

Before you run your python script, run this: export DISPLAY=:0.0 Then it should work as expected.


Top 50 recent answers are included