This warning also happens with inputs if you turn on the internal pullup:
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
If you're doing that, just let it use the external one that's there anyway:
If you are driving shift registers SPI will be the most efficient as you need to synchronise clock and data.
PWM is pointless as you need to have a synchronised data feed.
Using Python is not sensible if you need speed.
You could bit bang both clock and data with a C library. I doubt you would reach 1.76 Mb/s but you'd be in the right order of magnitude.
Yes, you can actually hook up an analog electret mic and use Pi Pico's inbuilt ADC to convert to Digital values. Then you need to convert those PCM values to suitable PDM values which can be fed into the feature provider.
Because it has DMA, no CPU cycles are wasted to access mic data from ADC. I read somewhere that we can sample up to 0.5 MHz using the ...
Ah, this is a very good program, so flexible to scale up. I would suggest the following changes.
To scale up from 2 relays to 8 relays, change the following first statement to second:
pinList = [10, 9]
pinList = [10, 9, 8, 7, 6, 5, 4, 3]
To change operation delay from two seconds to three seconds, say, change the following first statement to second.
Do you want the script to start at start-up or at logon? These are very different moments. For example: I have Pi's to which I seldom logon.
So, you've looked at rc.local, and it doesn't work. The rc.local way is as follows:
Make sure /etc/systemd/system/rc-local.service exists and contains something like:
This happens occasionally when cron is used to start programs under the @reboot schedule.
It happens because cron does not check that all required resources are available before starting the program/script you've specified. For example, if your program requires network resources, cron does not check that the network is available before starting your program. ...
This is somewhat of a workaround. It appears that at times the script can run before the pi has had a chance to boot up completely. Putting a sleep(30) just after my Imports fixed the issue. It ensures the logic of the script is executed after critical system functions are in place.
There are at least two problems with the level converter.
It is not connected to the breadboard. It appears to be a loose fit over some header pins. It needs to be soldered to the header pins.
The high and low +ve and -ve do not appear to be connected (if they are then SDA/SCL aren't connected).
My rain bucket was getting false triggers. It has a relatively long duration trigger so I just checked to see if the pin really went low.
if (GPIO.input(rainPin) == False) :
totalRain += .012
currentRain += .012
GPIO.add_event_detect(rainPin, GPIO.FALLING, callback=...
I don't think it is a good idea to drive the mototrs directly form the GPIO pins. It i s better tu use line direvers, Motor control hat etc. Because motors could draw more current when they startup and create problems.
This is being said. What pins you'd connect them depends on the program. Please refer to them and see which GPIO pins you need to connect ...
I will assume you are using the pigpio Python module.
You are correct to say that hardware_PWM can not be used at the same time as wave_chain.
I suggest you use the set_servo_pulsewidth method instead. This method can be used at the same time as wave_chain and is stable enough for servo operation.
Another option that will make multiple callback work together is to use threading and run the function with loop as thread:
threading.Thread(name='_thread_fireup_alarm', target=fireup_alarm, args=(channel,)).start()
while alarm_cancel == False:
Callbacks are emitted by one thread. Each callback will therefore run to completion before the next is called.
This is true for RPi.GPIO and all the other Pi GPIO Python and C modules that I am aware of.
Treat callbacks as interrupts. Do the minimum possible before returning, e.g. set a flag to be picked up in the main thread.
I found an online simulator here, but you can't modify the hardware: https://create.withcode.uk/python/A3
https://fritzing.org/ has hardware and code, but I have not tried the coding yet. It costs about $9 but is worth it in my opinion. They also have the option to create and upload your schematics and will send you a PCB board (for a fee).
Just for reference, there are two well-known approaches for addressing multiple keys with fewer pins: voltage ladder if you have analog pins and key matrix if you have digital pins. The Pi itself has no analog pins, but if you use an ADC, it's possible to use some of its channels for buttons.
Any non-standard wiring schemes are either suboptimal compared to ...
You could try something like the following - which will at least isolate buttons.
Pushing the centre button will activate both inputs - the others a single input. Strictly no diode is required on the isolated buttons.
simulate this circuit – Schematic created using CircuitLab
Sure, longer pins do exist:
An alternative is to have male pins on one side and female pins on the other:
Searching for "GPIO 2x20" in your favorite shopping site should give you similar results.
In both cases, you may need an iron which is thin enough to go between the pins to make sure the solder flows evenly around each pin.
You might be interested in Stacking headers (eg: https://www.adafruit.com/product/85)
Several boards all with stacking headers can be connected on top of each other, including to a breadboard at the bottom of the stack too.
Photo example to illustrate, just an arbitrary google images result:
You can get extended headers - I use these on my Pico so it plugs into a breadboard but still has accessible pins.
NOTE this will not let you use 2 HATs (as the pins would be inverted).
The normal solution is to use extended headers on the HAT.
There are really two parts to this question. Can you boot from floppy, and can you put an OS on a floppy.
As to whether you can put an OS on a floppy, yes of course you can. Quite apart from the good old days of MS-DOS 3.1, CP/M, et al, I have written small OS that will run from a floppy, it isn't difficult.
As an intellectual exercise or learning process, ...
Using the following wiring diagram:
With the code from https://github.com/makertut/raspberry-hc-sr04 :
(NOTE: code requires TRIG and ECHO to be swapped to match circuit)
import RPi.GPIO as GPIO
TRIG = 24
ECHO = 23
You can only control two servos independently with the Pi's hardware PWM.
GPIO 12/18 share a channel.
GPIO 13/19 share a channel.
The same settings apply to GPIO which share a channel.
E.g. If servo1 is on GPIO12 and servo2 on GPIO18 they will get the same signal (same frequency, same pulsewidth).
pigpio supports the hardware PWM features of the Pi. So you ...