Go to advanced search

by Paul Hutch
Sat Dec 07, 2019 12:56 pm
Forum: Python
Topic: Threading problems
Replies: 14
Views: 306

Re: Threading problems

It works now, but I got warning message: "QPixmap: It is not safe to use pixmaps outside the GUI thread". What does it mean? How to avoid it? This post and the other thread it links to explain the warning pretty well. https://stackoverflow.com/questions/50262348/how-to-solve-qpixmap-it-is-not-safe-...
by Paul Hutch
Thu Dec 05, 2019 5:44 pm
Forum: Python
Topic: [Py 4] pyserial int index
Replies: 1
Views: 53

Re: [Py 4] pyserial int index

You need to convert the integer into characters that you can read. Untested but I think this will work. Change: s.write(i) To: s.write(str(i)) IIRC, writing an integer to the serial port sends the ASCII character corresponding to the integer. since the first 32 ASCII characters are invisible you won...
by Paul Hutch
Tue Dec 03, 2019 1:14 pm
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 475

Re: Multitasking in Python

Oops, I made an essential point in my first post but failed to re-iterate it in my second post which has the timing interval tracking code. You absolutely want to use threads or subprocesses for tasks launched by a simple while loop time based scheduler. The only exception would be if all you are do...
by Paul Hutch
Tue Dec 03, 2019 1:01 pm
Forum: Python
Topic: What really does the processor do during time.sleep()?
Replies: 5
Views: 215

Re: What really does the processor do during time.sleep()?

I did a little test of the impact of various length sleep intervals on a simple loop on a Pi3B+ running Stretch desktop. #!/usr/bin/env python3 # -*- coding: UTF-8 -*- import time while True: print(".", sep='', end='', flush=True) # time.sleep(0.001) Results: Sleep interval/htop single CPU % none/10...
by Paul Hutch
Fri Nov 29, 2019 2:15 pm
Forum: Python
Topic: What really does the processor do during time.sleep()?
Replies: 5
Views: 215

Re: What really does the processor do during time.sleep()?

In a simple infinite loop without at least a tiny duration sleep, the loop will consume nearly 100% of the core it is running on. On a quad core processor like a Pi3 it will show as 25% overall processor utilization, a single core Pi Zero it will show close to 100% overall. Adding a tiny sleep will ...
by Paul Hutch
Thu Nov 28, 2019 4:28 pm
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 475

Re: Multitasking in Python

You can get accuracy within 10's of milliseconds by using simple monitoring of the amount of time you sleep. I've used the very simple code below in many projects with excellent results. I find it fits the PEP 20 philosophy of "Simple is better than complex." very well. import time loop_seconds = 0....
by Paul Hutch
Wed Nov 27, 2019 11:30 am
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 475

Re: Multitasking in Python

To reduce the processor load of your code you should use time.sleep() in your timing loop. Depending on the required timing accuracy, you can get the processor load of your code down to tiny fractions of a percent. https://docs.python.org/3/library/time.html Then for multi-tasking use Threading and ...
by Paul Hutch
Tue Nov 26, 2019 3:15 pm
Forum: General discussion
Topic: I'd like to buy two RasberryPi 3+. Most place have it out of stock
Replies: 7
Views: 300

Re: I'd like to buy two RasberryPi 3+. Most place have it out of stock

gd29 wrote:
Mon Nov 25, 2019 5:54 pm
Why would you need that specific model?
For myself it's because I'm not yet ready to move to Buster and I need 5GHz WiFi.
by Paul Hutch
Mon Nov 25, 2019 4:01 pm
Forum: Python
Topic: Simple cursor driven text menu in Python?
Replies: 5
Views: 150

Re: Simple cursor driven text menu in Python?

I've not done user input without an active login but I have done console output to HDMI without an active login. # Get a handle to the HDMI monitor console, requires root permissions hdmi_console = os.open("/dev/tty1", os.O_WRONLY) proc1 = subprocess.Popen(args=app_params, stdout=hdmi_console, stder...
by Paul Hutch
Thu Nov 21, 2019 9:55 pm
Forum: Python
Topic: Python and I2C
Replies: 4
Views: 166

Re: Python and I2C

by Paul Hutch
Wed Nov 20, 2019 5:56 pm
Forum: General discussion
Topic: Pi zero W possible to increase wi-fi strength/range?
Replies: 28
Views: 1049

Re: Pi zero W possible to increase wi-fi strength/range?

MalPi wrote:
Wed Nov 20, 2019 4:39 pm
discussing

If you had said "advocating" I would have agreed with you ! :)
Although I am not a compliance lawyer I have been advised by some for my work. They told me that even allowing discussion on a company run forum could be a problem in some jurisdictions.
by Paul Hutch
Wed Nov 20, 2019 4:26 pm
Forum: Staffroom, classroom and projects
Topic: How to make a weather station with Raspberry pi 3
Replies: 1
Views: 121

Re: How to make a weather station with Raspberry pi 3

This project from the Raspberry Pi Foundation may help, Build your own weather station.
https://projects.raspberrypi.org/en/pro ... er-station

I'm not sure but you may have to go through some of their other projects and tutorials first to get it all going.
by Paul Hutch
Wed Nov 20, 2019 4:16 pm
Forum: General discussion
Topic: Pi zero W possible to increase wi-fi strength/range?
Replies: 28
Views: 1049

Re: Pi zero W possible to increase wi-fi strength/range?

I was, I thought, engaging in interesting conversation. Please remind me, in future not to bother attempting interesting conversations on forums. Most people are not aware that in some jurisdictions a manufacturer can be fined for just providing instructions on how to change the tested RF emissions...
by Paul Hutch
Tue Nov 19, 2019 2:19 pm
Forum: General discussion
Topic: Wi-fi Password
Replies: 3
Views: 211

Re: Wi-fi Password

I don't think it is possible without a lot of custom code being written. On a normal WiFi network Raspbian already automatically logs back in after a connection drop. It seems the person running the WiFi has set up the system to prevent automatic login from working.
by Paul Hutch
Mon Nov 18, 2019 2:18 pm
Forum: General discussion
Topic: Pi zero W possible to increase wi-fi strength/range?
Replies: 28
Views: 1049

Re: Pi zero W possible to increase wi-fi strength/range?

I have a ZeroW running Stretch Lite outside about 30 feet from my R7000 beamforming router with all wood between the two and I'm getting very strong signals (measuring -39dBm, -30 is usually considered the best possible). Some energy efficiency coatings on windows also severely reduce radio transmis...
by Paul Hutch
Sun Nov 17, 2019 3:58 pm
Forum: Python
Topic: ctrl-c in python (the ^C being displayed specifically)
Replies: 4
Views: 153

Re: ctrl-c in python (the ^C being displayed specifically)

I don't see the Ctrl+C's when I quit my programs but instead of a pass for keyboard interrupts I have:

Code: Select all

    except KeyboardInterrupt:
        sys.exit(0)
by Paul Hutch
Sat Nov 16, 2019 1:17 pm
Forum: General discussion
Topic: Proper shutdown
Replies: 27
Views: 729

Re: Proper shutdown

I have one of those tiny HDDs in CF form somewhere. It wasn't very reliable. I had a Microdrive for my Jornada 720 and they were definitely more delicate than a normal hard disk. I no longer have the drive or the PCMCIA adapter, died long ago, but I still have the special storage case for the card ...
by Paul Hutch
Sat Nov 16, 2019 12:46 pm
Forum: General discussion
Topic: Custom Builds
Replies: 2
Views: 115

Re: Custom Builds

The only definitive answer to that question has to come from your intellectual property attorney.

With that disclaimer out of the way, from what I've seen every part of Raspbian Lite OS has licenses that will permit what you want to do (yes most of the parts have their own licenses).
by Paul Hutch
Wed Nov 13, 2019 9:38 pm
Forum: Python
Topic: import librairy serial
Replies: 8
Views: 609

Re: import librairy serial

Yes, it's a bit tricky deciding whether to use apt or pip when installing a library. I generally use pip so that I get the latest version of a library and I can more easily ensure I'm using the same version on all the platforms I'm writing code to run on. The main exception is large libraries that h...
by Paul Hutch
Sun Nov 10, 2019 9:40 pm
Forum: General discussion
Topic: What is the maximum temperature of the CPU before it gets demaged ?
Replies: 14
Views: 796

Re: What is the maximum temperature of the CPU before it gets demaged ?

The in-built throttling means you can't practically run over 85°C without using mythical overclocking settings that would be outside the spec for the processor. Not quite true. I've made multiple Pi3B+'s hit 94°C when running flat out in a 65°C oven, with clock throttling enabled. So when running i...
by Paul Hutch
Sun Nov 10, 2019 9:26 pm
Forum: Python
Topic: import librairy serial
Replies: 8
Views: 609

Re: import librairy serial

Glad to see you got is sorted out.
RobDpi wrote:
Sun Nov 10, 2019 3:01 pm
<snip>
pip installed the python3 package in the python2.7 folders.
You have to use pip3 to install to the Python 3 folders.
by Paul Hutch
Fri Nov 08, 2019 6:58 pm
Forum: General discussion
Topic: Network time sync on Raspbian Buster???
Replies: 8
Views: 293

Re: Network time sync on Raspbian Buster???

<snip> And if I use timedatectl it still does not work even though it exists: $ sudo timedatectl System has not been booted with systemd as init system (PID 1). Can't operate. Failed to create bus connection: Host is down <snip> The problem appears to be that somehow sytemd has been disabled on you...
by Paul Hutch
Sun Oct 20, 2019 11:38 am
Forum: Python
Topic: Continue *after* executing statements within a code block?
Replies: 15
Views: 1228

Re: Continue *after* executing statements within a code block?

Thank's PiGraham for confirming, it was just age and lack of caffeine causing my lack of thread following comprehension.
by Paul Hutch
Sat Oct 19, 2019 2:15 pm
Forum: Python
Topic: Continue *after* executing statements within a code block?
Replies: 15
Views: 1228

Re: Continue *after* executing statements within a code block?

Since you made this point I provided an example that demonstrated that it is perfectly possible to put commands between the if and the continue. It may just be having hit 60 recently and haven't had my second cup of coffee this morning :) , but I got a little confused trying to follow the thread. I...
by Paul Hutch
Sat Oct 19, 2019 2:02 am
Forum: Python
Topic: Copy site-packages
Replies: 3
Views: 512

Re: Copy site-packages

If the old version is still installed you can get a list and save it to a file. python** -m pip freeze > requirements.txt where python** is the OLD version of python. Then you use the requirements.txt file with the new pip to install all the packages. python** -m pip install -r requirements.txt wher...

Go to advanced search