Go to advanced search

by elParaguayo
Tue Jan 29, 2019 1:00 pm
Forum: Graphics, sound and multimedia
Topic: Sound Loop GPIO Music Box
Replies: 9
Views: 1687

Re: Sound Loop GPIO Music Box

OK. By default I think pygame has 8 channels but I think you can increase this . As for the code, I was just thinking something along the lines of: import pygame.mixer from pygame.mixer import Sound from gpiozero import Button from signal import pause pygame.mixer.init() button_sounds = { Button(21)...
by elParaguayo
Tue Jan 29, 2019 9:39 am
Forum: Graphics, sound and multimedia
Topic: Sound Loop GPIO Music Box
Replies: 9
Views: 1687

Re: Sound Loop GPIO Music Box

One way to do this would be to make the sound play on a particular channel. You can then use the "get_busy" method of the channel to check if the sound is playing. Your on_pressed method would then call a function that checks if a sound is playing. If it isn't, then it starts it. If it is, then it s...
by elParaguayo
Fri Aug 17, 2018 2:42 pm
Forum: Python
Topic: Python Script 'Invalid Syntax'
Replies: 18
Views: 1184

Re: Python Script 'Invalid Syntax'

You don't need to import picamera if you're calling a shell script (whether that is the best way to use the camera is beyond my expertise as I've never used the camera but I'd normally prefer to use python bindings rather than call external scripts). As for your code not starting, you could put some...
by elParaguayo
Fri Aug 17, 2018 12:55 pm
Forum: Python
Topic: Kivy GUI - Touch screen issue
Replies: 3
Views: 573

Re: Kivy GUI - Touch screen issue

Did you just configure the touchscreen in your local config file e.g. ~/.kivy/config.ini ?

You may need to change the global config instead.
by elParaguayo
Fri Aug 17, 2018 12:49 pm
Forum: Python
Topic: Python Script 'Invalid Syntax'
Replies: 18
Views: 1184

Re: Python Script 'Invalid Syntax'

You can try putting this at the very top of your file # -*- coding: utf-8 -*- However, it shouldn't be necessary here and I'm not sure why you're getting that message as there's no obvious stray character in your code. EDIT: I wonder if it's to do with this: /home/pi/t1_'date+%d%m%Y_%H%M-%S'.h264 Ca...
by elParaguayo
Fri Aug 17, 2018 12:31 pm
Forum: Python
Topic: Python Script 'Invalid Syntax'
Replies: 18
Views: 1184

Re: Python Script 'Invalid Syntax'

When you define functions, you need a colon at the end of the line:

Code: Select all

def startrecording():
Update your code throughout (and, yes, I missed it when I commented on using subprocess!)
by elParaguayo
Fri Aug 17, 2018 11:49 am
Forum: Python
Topic: Python Script 'Invalid Syntax'
Replies: 18
Views: 1184

Re: Python Script 'Invalid Syntax'

As above, please make sure your code is in code tags (read the link in PeterO's post). Without it, we lose the indentation and your code will make no sense. Next, when posting about python errors, post the whole error message (which includes line references) so we can home in on the relevant part. T...
by elParaguayo
Sun May 13, 2018 4:54 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: pigpio intefering with i2s?
Replies: 1
Views: 263

Re: pigpio intefering with i2s?

Ah. So, it's as easy as:

Code: Select all

sudo pigpiod -t 0
by elParaguayo
Sun May 13, 2018 1:08 pm
Forum: Graphics, sound and multimedia
Topic: ALSA: chaining slaves. Need both softvol and plugequal
Replies: 3
Views: 917

ALSA: chaining slaves. Need both softvol and plugequal

I'm having issues configuring ALSA to work with my needs. I have a HiFiberry miniamp and need to configure alsa to work with it. I need software volume control because I'm controlling volume through my code. However, I also need to use ALSA's plugequal equaliser as the sound sounds better that way. ...
by elParaguayo
Sun May 13, 2018 12:40 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: pigpio intefering with i2s?
Replies: 1
Views: 263

pigpio intefering with i2s?

I'm building a radio using the HiFiberry miniamp on i2s, using squeezelite as the player. When pigpiod is active, the music is very slow and, as a result, low. If I disable pigpiod the sound is fine. Is there a way to get pigpiod not to interfere with i2s? Or have I done something wrong?! For what i...
by elParaguayo
Sun Apr 22, 2018 5:06 pm
Forum: Python
Topic: Thread behaviour in Idle and Thonny
Replies: 10
Views: 742

Re: Thread behaviour in Idle and Thonny

Also, why aren't you using the proper threading module? Isn't the one you're using a dummy module? _thread python 3.5 https://docs.python.org/3.5/library/_thread.html But most user the higher threading https://docs.python.org/3.5/library/threading.html#module-threading I'm no expert in either. Yup,...
by elParaguayo
Sun Apr 22, 2018 8:56 am
Forum: Python
Topic: Voice Sensor Operated Servo Motor SG90
Replies: 12
Views: 1028

Re: Voice Sensor Operated Servo Motor SG90

I'm not experienced in this sort of project in any way shape or form but if I were doing it, I'd try find a way of monitoring audio levels and triggering an action when a threshold level is exceeded. Distinguishing the cry from other noises will be far too hard. Assuming your baby is in a quiet plac...
by elParaguayo
Sun Apr 22, 2018 8:11 am
Forum: Python
Topic: Thread behaviour in Idle and Thonny
Replies: 10
Views: 742

Re: Thread behaviour in Idle and Thonny

Please use code tags when posting code Never used Thonny but have you tried using a small sleep in your loop rather than pass? You could be maxing out your CPU. Also, why aren't you using the proper threading module? Isn't the one you're using a dummy module? EDIT: maybe the problem is just the way ...
by elParaguayo
Thu Apr 19, 2018 11:30 am
Forum: Python
Topic: Python subprocess not running under cron
Replies: 7
Views: 2356

Re: Python subprocess not running under cron

Please post in English if possible.

Can you post the line from your crontab.

Also, you probably want the full path to shutdown. I don't remember if it's /usr/bin/shutdown or /usr/sbin/shutdown.

EDIT: I think it's actually /sbin/shutdown
by elParaguayo
Fri Apr 06, 2018 6:33 am
Forum: Python
Topic: Python not importing modules
Replies: 2
Views: 358

Re: Python not importing modules

Error message would be a good place to start. Are you sure you've installed the module for python 3? You may think you have installed it but you may have only installed for python 2.
by elParaguayo
Fri Apr 06, 2018 6:03 am
Forum: Python
Topic: print the output using python
Replies: 2
Views: 606

Re: print the output using python

What's the problem with your code? This line:

Code: Select all

print('| {0:>6} | {1:>6} | {2:>6} | {3:>6} |'.format(*values))
should work fine as paddyg says. You don't even have to use all the values in the same line. e.g. you can just do:

Code: Select all

print('| {3:>6} |'.format(*values))
and the line is still valid.
by elParaguayo
Tue Mar 13, 2018 3:11 pm
Forum: Python
Topic: 7inch screen - multiple threads with Python possible ?
Replies: 1
Views: 252

Re: 7inch screen - multiple threads with Python possible ?

Not quite what you had in mind, but I used Kivy to do some fun stuff on the screen:
viewtopic.php?t=121392
by elParaguayo
Tue Mar 06, 2018 9:29 pm
Forum: Python
Topic: Flask(_name_) error please
Replies: 5
Views: 2742

Re: Flask(_name_) error please

Your error message still shows single underscores before and after name.
by elParaguayo
Mon Feb 19, 2018 7:20 pm
Forum: Python
Topic: shell script for the lcd shutdown
Replies: 13
Views: 1518

Re: shell script for the lcd shutdown

Sorry, had missed that it was your thread. Why not carry on in that thread if it's directly related?
by elParaguayo
Mon Feb 19, 2018 6:29 pm
Forum: Python
Topic: shell script for the lcd shutdown
Replies: 13
Views: 1518

Re: shell script for the lcd shutdown

Have you seen this thread: viewtopic.php?f=32&t=204627

If your question is different, please provide more information about what you're trying to do.
by elParaguayo
Wed Jan 31, 2018 8:22 pm
Forum: Python
Topic: twilio import Error with SSL
Replies: 10
Views: 1960

Re: twilio import Error with SSL

OK - so we're getting somewhere.

That error says the gpiozero module isn't installed.

At a command terminal, try:

Code: Select all

sudo apt install python3-gpiozero
and then run your code again.
by elParaguayo
Wed Jan 31, 2018 12:41 pm
Forum: Python
Topic: twilio import Error with SSL
Replies: 10
Views: 1960

Re: twilio import Error with SSL

That screenshot shows you typing the import command at a terminal prompt. That's not going to work.

The import command needs to be in a python environment so run "python3" from the terminal prompt and then try your import line.
by elParaguayo
Fri Jan 19, 2018 7:34 pm
Forum: Python
Topic: Bluetoothctl connect timeout error
Replies: 3
Views: 704

Re: Bluetoothctl connect timeout error

Doesn't that mean you'd be better posting your question on that github page?

Go to advanced search