Go to advanced search

by ben_nuttall
Mon Jun 10, 2019 5:30 pm
Forum: Python
Topic: Moving 16 servos in a wave
Replies: 11
Views: 277

Re: Moving 16 servos in a wave

Does the servo hat allow you to use GPIO Zero, or does it have another interface than just PWM on GPIO pins? Would be really easy with GPIO Zero: from gpiozero import Servo from gpiozero.tools import cos_values from signal import pause servos = [Servo(pin) for pin in (2, 3, 4, 5, 6, 7)] for servo in...
by ben_nuttall
Sun Jun 09, 2019 1:19 am
Forum: Python
Topic: Emergency Action Required by RPi Foundation
Replies: 31
Views: 1070

Re: Emergency Action Required by RPi Foundation

bensimmo wrote:
Sat Jun 08, 2019 5:08 pm
Ben, how's piwheels doing for 3.6/3.7 whichever ends up in Buster? (3.7 if it follows my RPDx86 "buster" test).
Is it all setup and ready?
I remember reading you were getting it ready, but haven't check to see how far you got.
Working on it! Will just be 3.7, not 3.6.
by ben_nuttall
Sat Jun 08, 2019 2:01 pm
Forum: Python
Topic: Python library not found: libpython3.7.so.1.0, libpython3.7m.so.1.0, libpython3.7mu.so.1.0
Replies: 4
Views: 181

Re: Python library not found: libpython3.7.so.1.0, libpython3.7m.so.1.0, libpython3.7mu.so.1.0

Looks like you've installed Python 3.7 on Raspbian Stretch. You can't install an out-of-distribution Python version and expect system Python packages (like python3-dev) to work. They're compiled for Python 3.5 that's included in the distribution (Stretch). I suggest you upgrade to Buster (unreleased...
by ben_nuttall
Sat Jun 08, 2019 1:47 pm
Forum: Python
Topic: Emergency Action Required by RPi Foundation
Replies: 31
Views: 1070

Re: Emergency Action Required by RPi Foundation

https://www.python.org/dev/peps/pep-0394/ This PEP states that `python` should not point to Python 3. Raspbian follows Debian. Debian decide what's in each release, what's supported and what's not. Debian Buster is due out soon, and they decided to keep Python 2.7 in the repo. That means they'll sup...
by ben_nuttall
Thu May 23, 2019 10:46 pm
Forum: Python
Topic: RPi CPU temp with Python
Replies: 15
Views: 14507

Re: RPi CPU temp with Python

Code: Select all

from gpiozero import CPUTemperature

cpu = CPUTemperature()

print(cpu.temperature)
https://gpiozero.readthedocs.io/en/stab ... emperature
by ben_nuttall
Tue Apr 23, 2019 2:57 pm
Forum: Python
Topic: Use RPi.GPIO Library on Eclipse (mac)
Replies: 2
Views: 128

Re: Use RPi.GPIO Library on Eclipse (mac)

You could use GPIO Zero's remote GPIO feature: https://gpiozero.readthedocs.io/en/stab ... _gpio.html
by ben_nuttall
Wed Apr 17, 2019 6:55 pm
Forum: Python
Topic: Updating Scipy 0.18 version to 1.2.1
Replies: 2
Views: 115

Re: Updating Scipy 0.18 version to 1.2.1

Code: Select all

sudo pip3 install scipy --upgrade
by ben_nuttall
Fri Mar 29, 2019 9:28 pm
Forum: Python
Topic: simulate run program
Replies: 5
Views: 234

Re: simulate run program

You can use mock pins provided by GPIO Zero. First open a terminal and set an environment variable: export GPIOZERO_PIN_FACTORY=mock Then open a Python prompt (or an IDE): python3 or idle3 & (for example) Now when you do GPIO stuff with GPIO Zero it's not touching the pins, and you can simulate butt...
by ben_nuttall
Mon Mar 25, 2019 4:36 pm
Forum: Python
Topic: Raspberry Pi3 project using GPIO and LEDs
Replies: 21
Views: 657

Re: Raspberry Pi3 project using GPIO and LEDs

Just tried to set an output using LED in gpiozero and then read its state using Button set to the same pin to read the LED state, causes an error because the pin is already in use by LED when the Button set up is attempted. You're trying to use an LED object to light an LED, and then a Button objec...
by ben_nuttall
Mon Mar 25, 2019 4:34 pm
Forum: Python
Topic: Raspberry Pi3 project using GPIO and LEDs
Replies: 21
Views: 657

Re: Raspberry Pi3 project using GPIO and LEDs

Simple wrote:
Mon Mar 25, 2019 2:35 pm
This is something that I would like to do and am wondering if I would be better off working with RPi.GPIO
Why?
by ben_nuttall
Sun Mar 24, 2019 12:08 pm
Forum: Python
Topic: Raspberry Pi3 project using GPIO and LEDs
Replies: 21
Views: 657

Re: Raspberry Pi3 project using GPIO and LEDs

Use PingServer and LED or PWMLED in GPIO Zero: https://gpiozero.readthedocs.io/en/stable/api_output.html#led https://gpiozero.readthedocs.io/en/stable/api_output.html#pwmled https://gpiozero.readthedocs.io/en/stable/api_internal.html#pingserver led.blink() # on / off every second led.blink(2, 2) # o...
by ben_nuttall
Fri Mar 15, 2019 10:00 pm
Forum: Python
Topic: installing gattlib for python3?
Replies: 1
Views: 435

Re: installing gattlib for python3?

It looks like some apt package which provides bluetooth.h will fix it. I'm tracking this in the piwheels issue tracker: https://github.com/bennuttall/piwheels/issues/129
by ben_nuttall
Fri Mar 15, 2019 9:53 pm
Forum: Python
Topic: Install pymc3
Replies: 3
Views: 415

Re: Install pymc3

Try:

Code: Select all

sudo pip3 install pymc3 -i https://www.piwheels.org/simple
by ben_nuttall
Fri Mar 15, 2019 12:42 am
Forum: Python
Topic: Install pymc3
Replies: 3
Views: 415

Re: Install pymc3

Are you trying to install for Python 2 or Python 3? And are you using Jessie or Stretch?

piwheels.org has wheels for pymc3 but only for Python 3.5 (Stretch).

So on Stretch, try:

Code: Select all

sudo pip3 install pymc3
and that should install it.
by ben_nuttall
Fri Mar 15, 2019 12:36 am
Forum: Python
Topic: GPIOzero button Migrating from RPi.GPIO
Replies: 1
Views: 295

Re: GPIOzero button Migrating from RPi.GPIO

You can't pull-down GPIO2 or GPIO3 as there are physical pull-up resistors on those pins. Try just using the button on its own and see if you can get the right results: from gpiozero import Button button = Button(2) while True: if button.is_pressed: print("pressed") else: print("released") If that w...
by ben_nuttall
Fri Mar 15, 2019 12:26 am
Forum: Python
Topic: picamera installation location varies - why?
Replies: 5
Views: 371

Re: picamera installation location varies - why?

With respect, that's just what @pootle said in the initial post... It's not. He said when it's pre-installed on Raspbian desktop, it's in A, when you install it on Raspbian Lite, it goes in B. I clarified that it depends how you install it, not which version of the OS you're on. I think the vital p...
by ben_nuttall
Wed Mar 13, 2019 4:50 pm
Forum: Python
Topic: picamera installation location varies - why?
Replies: 5
Views: 371

Re: picamera installation location varies - why?

If you install it with apt it ends up in /usr/lib/python3/dist-packages/picamera/

If you install it with pip it ends up in /usr/local/lib/python3.5/dist-packages/picamera/

The pre-installed version (in Raspbian desktop) is managed by apt.
by ben_nuttall
Sun Mar 10, 2019 1:25 am
Forum: Python
Topic: @property
Replies: 7
Views: 422

Re: @property

Why would they call themselves infinitely? Imagine the following regular function: def foo(bar): return "hello " + foo(bar) This would call itself indefinitely and trigger a RecursionError. What I did with the property first was define the foo attribute as "look up _foo and return that". That's fin...
by ben_nuttall
Thu Mar 07, 2019 4:37 pm
Forum: Python
Topic: @property
Replies: 7
Views: 422

Re: @property

That example is a pattern for providing getter/setter with logic but you're saving the value in a "private" attribute with the same name. I say "private" because it's not really private, they could still write to it with f._foo = "blah" but the public API is given as f.foo. Without using _foo: @prop...
by ben_nuttall
Wed Mar 06, 2019 10:20 pm
Forum: Python
Topic: @property
Replies: 7
Views: 422

Re: @property

You can think of properties as attributes with calculated values and custom rules for what they can be (or what happens when they're set). When you typed a.foo when it wasn't a property, it was a method. You call methods with brackets, so a.foo() would have returned 'bar'. Here is a class with a foo...
by ben_nuttall
Mon Feb 25, 2019 5:43 pm
Forum: Python
Topic: GPIOZero, tkinter and is_pressed
Replies: 3
Views: 265

Re: GPIOZero, tkinter and is_pressed

I added code tags to your post but the indentation is still all broken, please indent properly so we can read it. You code includes: while True: button.is_pressed = increment but that doesn't make sense. What do you expect it to do? You might find it easier to use guizero instead of tk. Here's a gui...
by ben_nuttall
Tue Feb 12, 2019 9:22 pm
Forum: Python
Topic: terribly messed up pip and pip3
Replies: 14
Views: 964

Re: terribly messed up pip and pip3

Download Stretch, upgrade to Buster, start from there. You'll find it much easier, and surely you've got nothing to lose on the old Jessie card?
by ben_nuttall
Mon Feb 11, 2019 10:55 am
Forum: Python
Topic: terribly messed up pip and pip3
Replies: 14
Views: 964

Re: terribly messed up pip and pip3

So you're on an old OS but want brand new Python? Why do you need Python 3.7? And how did you install it? You can't expect system pip to work with a non-system Python. If you can get Python 3.7 working, you'll definitely need to use "python3.7 get-pip.py" to install pip. I'd really recommend you upg...
by ben_nuttall
Sun Feb 10, 2019 1:22 pm
Forum: Python
Topic: terribly messed up pip and pip3
Replies: 14
Views: 964

Re: terribly messed up pip and pip3

Where did you get the SD card image from? Did you buy it pre-installed, or did you write the Raspbian image yourself? You're on an old version (Jessie) not the latest version (Stretch). You could download the latest image and write that to your card if you wanted to. Is Python itself working? Type "...

Go to advanced search