Go to advanced search

by paddyg
Fri Jan 17, 2020 2:19 pm
Forum: Python
Topic: Potentiometer Lagging
Replies: 2
Views: 102

Re: Potentiometer Lagging

I would have thought potentiometer would be read with AtoD. Is it an encoder? Do you have a part number or link to docs? If it's something like an encoder then it's best to trigger a function on change of GPIO and you have to assume that each 'edge' of the square wave consist of hundred of tiny open...
by paddyg
Wed Jan 15, 2020 11:14 pm
Forum: Python
Topic: declare integer array tmp[200][200]
Replies: 12
Views: 304

Re: declare integer array tmp[200][200]

I'm not sure how much the python "array" is used now. Python modules that use arrays seem to expect numpy ndarrays i.e. If you want to do very fast processing on arrays with numba then you will need to convert lists to numpy arrays when you pass them to @jit functions... but if you need an array tha...
by paddyg
Wed Jan 15, 2020 5:46 pm
Forum: General discussion
Topic: Future of raspberry pi - software related
Replies: 260
Views: 8359

Re: Future of raspberry pi - software related

Harking back a few posts to the "why not invent a new language that beginners can use (like python) but takes advantage of multithreading." That's already been invented and it's... python. Libraries such as numpy, tensorflow, numba and others spot opportunities for parallel processing and "just do i...
by paddyg
Mon Jan 13, 2020 10:46 pm
Forum: Python
Topic: Serial read and put values on a server
Replies: 1
Views: 86

Re: Serial read and put values on a server

There's quite a good description here. http://mattrichardson.com/Raspberry-Pi-Flask/ - of the web server end. Lots of stuff on pyserial generally available, though you might have to run that as another thread..
by paddyg
Sun Jan 12, 2020 2:54 pm
Forum: Python
Topic: Error accessing SHT35 (or SHT31) Temp and Humidity sensor in parallel via flask
Replies: 2
Views: 242

Re: Error accessing SHT35 (or SHT31) Temp and Humidity sensor in parallel via flask

Maybe you could cludge a kind of global lock ... def get_sht3x_temp(): global sht3x_lock for _i in range(5): # or whatever retry and 'not available' system you want to use if sht3x_lock time.sleep(0.5) else: break if sht3x_lock: return {'fTemp':-666, 'humidity':-666} sht3x_lock = True # SHT31 addres...
by paddyg
Sun Jan 12, 2020 2:34 pm
Forum: Python
Topic: Import Error: No module named Firebase.
Replies: 7
Views: 2352

Re: Import Error: No module named Firebase.

@neilgl yes that looks to be the case - still odd that the error isn't can't import name 'Firebase'. Still it would be sensible to open a python terminal and try a few imports etc.
>>> import firebase
>>> dir(firebase)
by paddyg
Sun Jan 12, 2020 11:14 am
Forum: Python
Topic: Import Error: No module named Firebase.
Replies: 7
Views: 2352

Re: Import Error: No module named Firebase.

does everything need to be run as root (that often causes problems)? Better to "pip3 install firebase --user" which prompts the next question. Did you actually have "install" in your pip3 command? It's missing from your description of what you did. What messages did you get on screen after you insta...
by paddyg
Sat Jan 11, 2020 11:06 am
Forum: Python
Topic: Classes and For Loops
Replies: 9
Views: 330

Re: Classes and For Loops

Just for completeness, and to follow up on @Paeyrn's very good point about copying lists with [:] (which I admit I hadn't really thought about). It occurred to me that the tidiest way to do what the OP intended might be to mark instances of Invader and Bullet with a dead flag, and not attempt to del...
by paddyg
Fri Jan 10, 2020 7:58 am
Forum: Python
Topic: Need help installing MQTT using these python commands
Replies: 9
Views: 263

Re: Need help installing MQTT using these python commands

@hamilc, I know it's frustrating not to jump straight in and make something useful... However, if you've decided to make a project using python, I would strongly recommend spending a day or two working through an introductory course. Lots available including ones on this website.
by paddyg
Fri Jan 10, 2020 12:03 am
Forum: Python
Topic: Need help installing MQTT using these python commands
Replies: 9
Views: 263

Re: Need help installing MQTT using these python commands

This seems to work ok i.e. client = mqtt.Client() creates an instance of the mqtt.Client class which can subsequently be used (set id and pw then connect etc). Passing args as client_name will assume it's the first arg i.e. client_id so you have to set that variable correctly.
by paddyg
Thu Jan 09, 2020 11:56 pm
Forum: Python
Topic: Classes and For Loops
Replies: 9
Views: 330

Re: Classes and For Loops

You can start at the other end of the list

Code: Select all

for number in numbers[::-1]:
and it *seems* to behave. However I'm not sure I would trust it in all circumstance!
by paddyg
Thu Jan 09, 2020 9:44 pm
Forum: Python
Topic: picamera and EXIF Tags-Solved
Replies: 5
Views: 217

Re: picamera and EXIF Tags-Solved

Yes, @scruss is probably right. I think I wouldn't save the image but capture to numpy array then convert to PIL Image . I don't know if that will then have exif editing available (or if it's tied up with jpeg). I check it out later if I get chance. Paddy PS I think reading the exif info is a lazy o...
by paddyg
Sat Jan 04, 2020 1:48 pm
Forum: Python
Topic: Raspberry Snake in Python 2--Game not working, Unknown Error
Replies: 4
Views: 376

Re: Raspberry Snake in Python 2--Game not working, Unknown Error

As of last Tuesday night python2 has reached end of life, so unless you have a burning need to use it I would suggest switching to python3. I don't have the exact code you're using but I found an approximation to the listing below elsewhere on this forum and it seems to work on this laptop with pyth...
by paddyg
Sat Jan 04, 2020 9:00 am
Forum: Python
Topic: Python library to get EXIF tags from camera?
Replies: 6
Views: 475

Re: Python library to get EXIF tags from camera?

PIL which is actually Pillow and installed on default raspbian can get most exif data pretty well. Here is a rather complicated demo but the actual exif bit is quite simple. https://github.com/pi3d/pi3d_demos/blob/master/PictureFrame.py around line 139 and 166. The version of Pillow on buster is qui...
by paddyg
Mon Dec 30, 2019 8:41 am
Forum: Python
Topic: rewrite value in specific column csv file
Replies: 6
Views: 211

Re: rewrite value in specific column csv file

You can read and write into the middle of a file but you would have to have a scheme for keeping track of the data in a structured form. That's what a db would do for you. If it's only a small amount of data read and write it into a variable using pickle or json. Or csv as suggested.
by paddyg
Sun Dec 29, 2019 9:36 am
Forum: Gaming
Topic: R-Pi Massively Multiplayer Online Role-Playing Games (MMORPG)
Replies: 312
Views: 87868

Re: R-Pi Massively Multiplayer Online Role-Playing Games (MMORPG)

Components still there but it needs an enthusiastic ringleader.
by paddyg
Mon Dec 23, 2019 2:24 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 226
Views: 40000

Re: Image viewer with transition between images

That looks an odd error message. Let me see what the lines around 161 look like in your version of PictureFrame.py, maybe something sneaked in while you were editing. They should be random.shuffle(temp_list_first) random.shuffle(temp_list_last) file_list = temp_list_first + temp_list_last else: file...
by paddyg
Sat Dec 21, 2019 3:26 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 226
Views: 40000

Re: Image viewer with transition between images

Glad you got it working and glad you like it. That glGetError 0x500 means that at some point (prior to the previous call to glGetError()) an instruction to the GPU used an invalid enumerant. That translates as meaning one of the values passed to one of the OpenGL(ES) function didn't match whatever i...
by paddyg
Sat Dec 21, 2019 2:02 pm
Forum: General discussion
Topic: Image viewer with transition between images
Replies: 226
Views: 40000

Re: Image viewer with transition between images

@atpost, It looks to be the keyboard input that's causing the problem (it uses curses - good name!). I meant to make that optional in the last release but it must have slipped through. In the mean time you can comment out the keyboard stuff like this (this is a 'diff' showing just what changes befor...
by paddyg
Fri Dec 20, 2019 11:47 am
Forum: Graphics programming
Topic: Pi3D transparent background on Pi4
Replies: 88
Views: 8291

Re: Pi3D transparent background on Pi4

Hi, yes the 'layer' options is specifically the dispmanx layer so I wouldn't expect it to have any effect unless using the bcm drivers (aka legacy) on the RPis prior to v4. When you test your code on the RPi3 are your using fake KMS? As we discussed back on page 1/2 of this thread it would be nice t...
by paddyg
Sun Dec 15, 2019 8:22 am
Forum: Python
Topic: write and running python programs on windows
Replies: 4
Views: 276

Re: write and running python programs on windows

Yes I think there are a few and I would suggest googling. The first one I found was called fake_pi
by paddyg
Fri Dec 13, 2019 6:16 pm
Forum: Python
Topic: Webinterface - FLASK and while loop
Replies: 2
Views: 253

Re: Webinterface - FLASK and while loop

Do you need to set the global light_on True? You might need to put your actions into functions and run them in threads to stop the whole thing getting stuck in a flashing light loop. I think you have to put global as the first line of the function. Finally I think you can pass a list to gpio.setup s...
by paddyg
Wed Dec 11, 2019 6:50 pm
Forum: Python
Topic: Python script stops after 1 minute after boot
Replies: 5
Views: 286

Re: Python script stops after 1 minute after boot

So it's quite an obvious problem - once you know what it is! I just tried your code on my RPi and (after I struggled to get the internal pull-up to work at all, not sure what that's about. More investigation needed) I had exactly your problem. Then when I tried typing the mpg123 etc on the command l...
by paddyg
Wed Dec 11, 2019 8:38 am
Forum: Python
Topic: Render pi3d over omxplayer on pi4
Replies: 3
Views: 237

Re: Render pi3d over omxplayer on pi4

@pescew Glad that you seem to be able to find a way round the issue; I was going to suggest VLC or suchlike. I think everything (including omxplayer) uses ffmpeg inside (it's a very comprehensive, handy library) so you probably always get that, but it probably cuts out a bit of processing overhead t...
by paddyg
Tue Dec 10, 2019 11:43 pm
Forum: Python
Topic: trouble with gpiozero
Replies: 1
Views: 131

Re: trouble with gpiozero

https://gpiozero.readthedocs.io/en/stab ... t.html#led i.e. my_led.is_lit will be a boolean value (it is a function but it's hidden behind a decorator so that it behaves like a property (all things to google if they're not familiar))

Go to advanced search