New answers tagged

0

The link to the tutorial you gave seems to be broken but I'm guessing it's this one while searching for that tutorial I also found this which has some additional information. First you need to determine how many half steps your motor takes to execute a full 360. From the second link you can see that the datasheet for the 288yj-48 stepper seems to indicate ...


0

this does not works for me but this works def readLong(): block = bus.read_i2c_block_data(address, 1) #second arg is 'cmd'. It is andatory but not used in this case. It may be used by the higher level protocol n=struct.unpack('<l',bytes(block[:4]))[0] return n


0

You can also implement an i2c scan with the Adafruit Blinka library: import board import busio def i2c_scan(i2c): devices = [] for x in range(0x08, 0x79): try: result = bytearray(1) i2c.readfrom_into(x, result) devices.append(x) except OSError: pass return devices i2c = busio.I2C(...


1

Remove your GPIO.cleanup() lines, this would normally only be called before you exit a program. https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/ Cleanup At the end any program, it is good practice to clean up any resources you might have used. This is no different with RPi.GPIO. By returning all channels you have used back to ...


0

Actually that's cd $PLATYPUSH_SRC_DIR, the $ is significant (used to indicate an environment variable). But using that is unlikely to make a difference as it is probably not set. It looks like it is referring to the toplevel directory of the source you presumably downloaded or git cloned.


1

On the Pi, you have to bind the socket to an IP address of one of the Pi's interfaces. You cannot bind it to the PC's IP address. If you want the socket to accept connections from all of the Pi's interfaces, you can use the IP address 0.0.0.0 (or :: in IPv6). On the PC, the server IP should be an IP address that the Pi is bound to. Let's say the Pi is ...


1

I've same display. I've changed in clock_EN.py: Raspberry Pi pin configuration: RST = 27 DC = 25 LED = 24 in Raspberry Pi pin configuration: RST = 25 DC = 24 LED = 27 ... and now it works


3

There are some things with output redirection, path environment variable, directory back and forth, which make things a bit confusing. In addition it isn't defined when the cron job is executed. It is possible that it already runs when the WiFi isn't available. To manage all this in a clean way you should use systemd. You can create a new service for it with ...


1

Well if it’s tight you want: def begin_time(time = 5): print(time) begin.when_pressed = begin_time Personally, I find this easier to understand than the more pythonic lambda :-) but have to say the lambda version has more flexibility for changing the value.


2

You can create a function that takes no parameters: def begin_time_5(): begin_time(5) begin.when_pressed = begin_time_5 This is called "currying". Alternatively, use a lambda: begin.when_pressed = lambda: begin_time(5)


2

If you are using the full resolution and a high frame rate, it is very likely that the processor and/or memory is getting exhausted (depending on what kind of processing you are doing). So, yes, lowering the camera resolution may solve the problem. You do not say what programming language you are using. In python you can change the resolution like this: ...


0

A lot depends on what you want the program to do while waiting for the button to be pressed. Button abilities here You could try (untested code though): from gpiozero import Button import time def begin_time(time): print(time) begin = Button(27) # Loop doing nothing till the button is pressed while being.is_held == False: time.sleep(0.01)...


1

The documentation you link is to the UART. See https://pypi.org/project/spidev/ for the available spidev module documentation. As for the meaning of mode perhaps look at a SPI wiki.


0

Question How can Rpi python read a SPI MFRC255 RFID/NFC tag? Short Answer Part 1 - Introduction to I2C and SPI NFC/RFID Chips and Modules Part 2 - Setting up SPI MFRC522 Module Part 3 - Troubleshooting SPI Software and Hardware using Loopback Part 4 - Using Rpi4B buster Python 3 and Mfrc522 library to read NFC Tag I have successfully installed ...


0

It looks like that if you click the button, you are still checking if event.keysym == 'w' so it is falling through to the else:


1

In my case the current from my power supply to the relay module was not sufficient at 1.0 amps. I swapped it out with one rated at 2.0 amps and that got my relays switching. Thank you all.


0

One advantage of VNC is that you do not need to open any ports in the firewall to control the Pi. A lot of companies are loathe for Pi boards to be installed on the LAN for this reason and often restrict access to the VNC cloud services because fo this (see NASA for why using a PI like this is a very bad idea). With the free version of VNC the only way ...


1

Well, this should be asked into IoT and maybe they'll tell you to ask into Electronics. With rpis being catch-all wizards I guess I'll drop you a line anyway. Does mac tx and radio tx commands are used for same purpose? Absolutely not. It's better to start from the raw radio tx. Look at the example: radio tx 48656c6C6F // Transmits a packet of [0x48][...


0

I "Fixed" it by creating an virtual environment for opencv.


3

2020 Update: Nowadays modern Linux distributions, including Raspbian, use systemd instead of old style SysV as init system. For downstream compatibility SysV is only emulated by systemd but will lose support more and more by time so you should not use SysV anymore, in particular /etc/rc.local! For more information about this have a look at Compatibility ...


4

I duplicated what you did using an up-to-date Raspbian Buster in a Pi 4 B. (I wish all questions were as clear and complete as yours!) Double-clicking the file on my machine brought up the thonny IDE. (Note: The 'any' key doesn't work because input() needs an enter to complete.) On reboot, I observed the same result you did. However, installing xterm ...


2

Create a file: nano /etc/systemd/system/startupbrowser.service Put all lines below there: [Unit] Description=testfile service [Service] ExecStart=/usr/bin/python /home/pi/Documents/testfile.py StandardOutput=syslog StandardError=syslog Restart=on-failure User=root Group=root SyslogIdentifier=testfile [Install] WantedBy=multi-user.target Save ...


1

If you don't care about execution time, increasing your swap size from 100MB to a couple of GB will triple the amount of available memory. Projecting your current code efficiency (1 GB or RAM needed to process 16 MB of data), you should be able to process up to 48 MB of data at once. sudo dphys-swapfile swapoff echo 'CONF_SWAPSIZE=2048'|sudo tee /etc/dphys-...


0

Without connection details this is unanswerable. If you are trying to use a single resistor in the common leg it is no wonder it is unreliable as each LED has a different voltage and only the lowest (usually Red) will work. NOTE coloured LEDs often need >3V so won't work reliably on the Pi - you may need transistors. PS running without a current limiting ...


1

Don't continually call the dutycycle function. You are probably resetting its function many times per second. Try something like ... import time ... if len(sys.argv) > 3: # converteer de waarde 255 tot max 100 voor PWM. roodwaarde = (int(sys.argv[1]) * 100) / 255 groenwaarde = (int(sys.argv[2]) * 100) / 255 blauwwaarde = (int(sys.argv[3]) * ...


2

In your code, the return command is placed outside the get_distance function. The return command can only be used when it is in a function, so it returns the output of the function you specify. When you use return distance, you should keep it in the function or it won’t make any sense to Python. Right now, it ends with global start.


1

I'm running on a raspbian buster with Python 3.7.3. I ran into the same issue, "ERROR...no activation script". I tried @Lombax answer but it didn't work. However, I noticed that the version of virtualenvwrapper I had installed was 5.0.0. I checked on PyPi and it's still at version 4.8.4. So I uninstalled virtualenv and virtualenvwrapper: sudo pip3 uninstall ...


1

I answered your question according to "what you expect to do". Honestly, it's not a good idea to show the camera stream over a remote desktop tool like VNC. You should improve your code to stream the camera over the HTTP protocol to create an RTC connection. You could do it with the help of OpenCV on python. Although, I suggest you install the motion ...


2

As you wrote in a comment you only want to start the web browser. Wrap it into a python script isn't needed. That's only an additional layer of execution and waste of resources. Just start the browser direct. Because we need a graphical environment try this service: rpi ~$ sudo systemctl --force --full edit run-browser.service In the empty editor insert ...


1

I had a similar issue with my Pi. Doing a simple pip install solved the issue. pip install RPi.GPIO


1

I am using X11 forwarding on the raspberry and putty on windows. This way you can see the display of the raspberry on your laptop. I haven't had issues with it. To set it up you need to enable ssh in raspi-config. Then edit sudo nano /etc/ssh/sshd_config and uncomment the line X11Forwarding yes install xming and putty on your laptop and set up putty under ...


1

You are not allowed to use commands in systemd services.: The command to execute must be an absolute path name. Source: systemd.service You should add the exact path of the command. You can find that by this command: which python You would get the output as it: /usr/bin/python Finally, use the output of which command to your systemd service. ...


1

You can do it if the device is the same. The point of a virtual environment is to be able to replicate it everywhere you need it. Make a script that installs all necessary dependencies from a requirements.txt file and use it. Use the command bellow to get the list of all python packages installed: pip freeze > requirements.txt Then install the ...


1

Web browsers work very hard to keep what happens within the browser from changing anything else on the computer running the browser. This is essential to maintaining security from malicious web sites. One way of doing what you want is to run a small server on the Raspberry Pi and have the web page, also running in a browser on the Raspberry Pi, send a ...


1

I am also facing the same error. You must add these lines on ~/.profile export WORKON_HOME=$HOME/.virtualenvs export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv source /usr/local/bin/virtualenvwrapper.sh export VIRTUALENVWRAPPER_ENV_BIN_DIR=bin


Top 50 recent answers are included