Search found 1943 matches
- Tue Jan 29, 2019 1:00 pm
- Forum: Graphics, sound and multimedia
- Topic: Sound Loop GPIO Music Box
- Replies: 9
- Views: 3221
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)...
- Tue Jan 29, 2019 9:39 am
- Forum: Graphics, sound and multimedia
- Topic: Sound Loop GPIO Music Box
- Replies: 9
- Views: 3221
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,...
- Fri Aug 17, 2018 2:42 pm
- Forum: Python
- Topic: Python Script 'Invalid Syntax'
- Replies: 18
- Views: 3960
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...
- Fri Aug 17, 2018 12:55 pm
- Forum: Python
- Topic: Kivy GUI - Touch screen issue
- Replies: 3
- Views: 1658
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.
You may need to change the global config instead.
- Fri Aug 17, 2018 12:49 pm
- Forum: Python
- Topic: Python Script 'Invalid Syntax'
- Replies: 18
- Views: 3960
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...
- Fri Aug 17, 2018 12:31 pm
- Forum: Python
- Topic: Python Script 'Invalid Syntax'
- Replies: 18
- Views: 3960
Re: Python Script 'Invalid Syntax'
When you define functions, you need a colon at the end of the line:
Update your code throughout (and, yes, I missed it when I commented on using subprocess!)
Code: Select all
def startrecording():
- Fri Aug 17, 2018 11:49 am
- Forum: Python
- Topic: Python Script 'Invalid Syntax'
- Replies: 18
- Views: 3960
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...
- Sun May 13, 2018 4:54 pm
- Forum: Interfacing (DSI, CSI, I2C, etc.)
- Topic: pigpio intefering with i2s?
- Replies: 1
- Views: 1007
Re: pigpio intefering with i2s?
Ah. So, it's as easy as:
Code: Select all
sudo pigpiod -t 0
- Sun May 13, 2018 3:35 pm
- Forum: Graphics, sound and multimedia
- Topic: ALSA: chaining slaves. Need both softvol and plugequal
- Replies: 3
- Views: 2187
Re: ALSA: chaining slaves. Need both softvol and plugequal
Thanks. I'll take a look.
- Sun May 13, 2018 1:08 pm
- Forum: Graphics, sound and multimedia
- Topic: ALSA: chaining slaves. Need both softvol and plugequal
- Replies: 3
- Views: 2187
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. ...
- Sun May 13, 2018 12:40 pm
- Forum: Interfacing (DSI, CSI, I2C, etc.)
- Topic: pigpio intefering with i2s?
- Replies: 1
- Views: 1007
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...
- Sun Apr 22, 2018 5:06 pm
- Forum: Python
- Topic: Thread behaviour in Idle and Thonny
- Replies: 10
- Views: 1796
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,...
- Sun Apr 22, 2018 8:56 am
- Forum: Python
- Topic: Voice Sensor Operated Servo Motor SG90
- Replies: 12
- Views: 2638
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...
- Sun Apr 22, 2018 8:11 am
- Forum: Python
- Topic: Thread behaviour in Idle and Thonny
- Replies: 10
- Views: 1796
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 ...
- Thu Apr 19, 2018 11:30 am
- Forum: Python
- Topic: Python subprocess not running under cron
- Replies: 7
- Views: 4944
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
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
- Fri Apr 06, 2018 6:33 am
- Forum: Python
- Topic: Python not importing modules
- Replies: 2
- Views: 744
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.
- Fri Apr 06, 2018 6:03 am
- Forum: Python
- Topic: print the output using python
- Replies: 2
- Views: 1622
Re: print the output using python
What's the problem with your code? This line: 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: print('| {3:>6} |'.format(*values)) and the line is still valid.
- Tue Mar 13, 2018 3:11 pm
- Forum: Python
- Topic: 7inch screen - multiple threads with Python possible ?
- Replies: 1
- Views: 622
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
viewtopic.php?t=121392
- Tue Mar 06, 2018 9:29 pm
- Forum: Python
- Topic: Flask(_name_) error please
- Replies: 5
- Views: 6204
Re: Flask(_name_) error please
Your error message still shows single underscores before and after name.
- Tue Feb 20, 2018 6:52 am
- Forum: Python
- Topic: download image from website
- Replies: 1
- Views: 1820
- Mon Feb 19, 2018 7:20 pm
- Forum: Python
- Topic: shell script for the lcd shutdown
- Replies: 13
- Views: 3388
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?
- Mon Feb 19, 2018 6:29 pm
- Forum: Python
- Topic: shell script for the lcd shutdown
- Replies: 13
- Views: 3388
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.
If your question is different, please provide more information about what you're trying to do.
- Wed Jan 31, 2018 8:22 pm
- Forum: Python
- Topic: twilio import Error with SSL
- Replies: 10
- Views: 3489
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:and then run your code again.
That error says the gpiozero module isn't installed.
At a command terminal, try:
Code: Select all
sudo apt install python3-gpiozero
- Wed Jan 31, 2018 12:41 pm
- Forum: Python
- Topic: twilio import Error with SSL
- Replies: 10
- Views: 3489
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.
The import command needs to be in a python environment so run "python3" from the terminal prompt and then try your import line.
- Fri Jan 19, 2018 7:34 pm
- Forum: Python
- Topic: Bluetoothctl connect timeout error
- Replies: 3
- Views: 1578
Re: Bluetoothctl connect timeout error
Doesn't that mean you'd be better posting your question on that github page?