Kirk Fraser
Posts: 50
Joined: Thu Feb 13, 2014 6:52 am

Does Python do A/V/U and call itself?

Mon Feb 12, 2018 8:50 pm

Does Python do Audio / Video / USB and can you write a program to write Python code and have it execute? If yes to all, where can I learn how to do all these things? I want to run a robot that can read, write, and hear. I am working on a compiler for a new computer language which I hope will be better than Scratch and I started the parser and executor on Squeak as Scratch is but I did not find A/V/U all supported. I've read Python also controls the GPIO pins which may be useful.

I bought one of the new Logitech 4K cameras which I hope will give my robot better webcam vision but how can I find code to make it work and detect visual objects? Thank you.

User avatar
bensimmo
Posts: 4623
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Does Python do A/V/U and call itself?

Mon Feb 12, 2018 9:21 pm

Goto the python website, they have all its built in commands.

But it'll do what it is programmed to do.
Often you just find modules (OpenCV for example) and use the time and effort they have spent. Feeding back your own ideas and problems, the best take them on board

Otherwise it's write your own from the standard commands or write a bit in another language (C often) and use that in python.
It can read GPIO as does Scratch because somebody has built part for the language to do just that (pigpio being a RaspberryPi example)

Have fun, read around and some others may be able to give more specifics.

But use Python3 and their website.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Does Python do A/V/U and call itself?

Tue Feb 13, 2018 8:28 am

The Python Standard Library does not include Audio/Video/USB support. Additional Libraries have to be installed (this is the case for all general-purpose languages, even C).

Furthermore "USB" should not be handled by yourself or Python. Raspbian Linux supports hundreds of USB devices via precompiled kernel modules which should be loaded on demand. Since the mantra "everything is a file" of Unix carries over to Linux, device files should appear when USB devices get inserted and disappear when removed. If that doesn't work, you're doing it wrong™.

I suggest pv4l2 for Video (over USB) and PyGame for audio (over USB or not).

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “Python”