New answers tagged

2

Using dir and help on the whole module or on specific classes or objects: >>> from gpiozero import * >>> dir(gpiozero) >>> help(gpiozero) >>> btn = Button(2) >>> dir(btn) # or dir(Button) >>> help(btn) # or help(Button) Alternatively use the IPython shell and you can use e.g. Button? + <Enter> ...


5

This is not a Pi specific question, but all the normal python commands work (at least as well as in any python shell) e.g. import gpiozero help(gpiozero) dir(gpiozero) To document the Button class help(gpiozero.Button) The gpiozero Documentation is more helpful. https://gpiozero.readthedocs.io/en/stable/


1

Don't bother! You CAN install from source, but it is a lot of effort. AFAIK Raspbian hasn't had Python 3.4 since Jessie which is obsolete. There would be lots of other superseded programs as well. "I have 3.5 working on a Rpi3" - again you are using an old OS. Do a fresh install of Raspbian-Buster - you only have to do this every 2 years!


1

You're probably using Raspbian Jessie (?). That will not get a later version of Python. Install Raspbian Buster and you will get Python 3.7


1

Answer Part 1 - Over simplified explanation of the L298N Dual Bridge Motor Driver Now let us first look at the picture below. (1.1) Suppose the switches SW1 and Sw2 are in their positions as shown. The electric current will flow from +12V, following the little pink arrows, passing through the coil, I mean the motor coil, and the motor will turn happily ...


1

Answer Part 1 Part 2 / to continue, ... Discussion, conclusion, and recommendation / to continue, ... What next / to continue, ... References (1) Adafruit PCA9685 16-Channel PWM / Servo Controller Tutorial - Lady Ada / to continue, ... Appendices / to continue, ... Photos / to continue, ... Schematics / to continue, ... Figures Figure 1 - ...


3

As the code is written in your question, it is creating an unlimited number of callbacks. Eventually the system will fall over because of a lack of resources. Also a pigpio callback receives a set number of parameters (being gpio, level, and tick). You can't pass the return value of a function call as a callback. Change while(pwm_p.is_alive()): cb = ...


1

As far as I am aware the RPi.GPIO module only allows interrupts and wait for edge on GPIO which are in mode INPUT. That means you can't use those features on a GPIO outputting PWM (e.g. a GPIO in mode PWM or mode OUTPUT). pigpio will allow alerts and wait for edge on such GPIO.


1

You need to look at a wiki to see how hobby servos are controlled. Also look up the meaning of PWM. Basically they expect a series of pulses at about 50 Hz. That means they expect a series of pulses at about 50 per second. Each pulse has a length. The length determines the angle the servo is meant to go to. Generally a pulse of length 1500 µs means go ...


2

Executive Summary Helping to understand the OP's AI (OpenCV!) robot car code. / to continue, ... Contents 1.0 Answer 1.1 motor, led python modules summary 1.2 server, run python modules summary 2.0 References 3.0 Appendices 4.0 Schematic (L298 Motor Driver) / to continue, ... 1.0 Answer 1.1 - Walking through low level (GPIO, DC motor) functions ...


1

/dev/tty1 is NOT a USB port. This is the default console. There should be no need to "open" it and certainly repeatedly opening and closing stdin is just going to cause character loss. I suspect the (unspecified) RFID reader is designed to emulate a keyboard. Just read as you would a keyboard!


1

Why are you repeatedly opening and closing the port ? You could just open it once at the start of your program, wait for data and close it when you are done with it and when an exception occurs. Otherwise I believe something like this could work too: import sys for line in sys.stdin: # do something Alternatively you could use a dedicated library for ...


Top 50 recent answers are included