Shop OBEX P1 Docs P2 Docs Learn Events
Project — Parallax Forums

Project

Sheher AliSheher Ali Posts: 3
edited 2012-11-11 10:33 in Robotics
hi,
I got a project where i am using parallex propeller to play audio and video file with push buttons. Each button is for a specific audio or video file, once the button is hot it should play that file. I got a player software on parallex website but this code is just playing all files on one pin(assosiated to button) and push button is doing nothing.

That will be great if anyone can help me in this case.

Comments

  • SRLMSRLM Posts: 5,045
    edited 2012-11-08 16:00
    You're (probably) going to be disappointed: the Propeller cannot do very good video playback due to it's limited memory size and speed. I would suggest using a small ARM board (Beagle*, RaspberryPi, etc.) to do the video and audio playback.

    If you're willing to drop the video requirement, something like the AP-16+ module from Parallax would work: http://www.parallax.com/Store/Accessories/Sound/tabid/164/ProductID/697/List/0/Default.aspx?SortField=ProductName,ProductName

    You'll need some sort of microcontroller (Propeller, BS2, Arduino, etc.) to interface between the buttons and the AP-16+, since the firmware isn't open for hacking.
  • Sheher AliSheher Ali Posts: 3
    edited 2012-11-08 19:46
    The video files I am using are small in size and I am also using an sd card to store my video and audio files. so I am wondering if someone can help me how to program it to work with push buttons by hanving one file for one pin( attached to the button).
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-11 08:46
    It doesn't matter whether the video files are small or large. The Propeller is neither fast enough nor has enough memory to handle conventional video files although it can do low resolution video files. It certainly cannot handle the computational requirements of compressed video files. There are some programs in the Propeller Object Exchange which can play uncompressed audio files (and the AP-16+ can do this as well), but the Propeller can't handle MP3 file decompression.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-11 09:09
    If you want to use the coarse video player in the Object Exchange, you can modify it to select one of several video files to open. The routine to play a piece of video looks like this:
    PUB Movie(n) 
        fat.openfile(string("taz.pmv"),"R")      ' 160x120 per frame, saved as a binary file
        repeat i from 1 to n ' number of frames
          fat.readdata(pix.displaypointer,19200)
        fat.closefile
    
    You'd modify it to choose a file whose name is of the form MOVIE00.PMV like this:
    PUB Movie(x, n) | name[3]
        bytemove(@name, string("MOVIE00.PMV"), 12)   ' initialize file name including zero byte at the end
        name.byte[5] := x / 10 + "0"
        name.byte[6] := x // 10 + "0"
        fat.openfile(@name,"R")      ' 160x120 per frame, saved as a binary file
        repeat i from 1 to n ' number of frames
          fat.readdata(pix.displaypointer,19200)
        fat.closefile
    
    Instead of having "Movie(837)" in the main method, you'd use a CASE statement like this:
        case movieNumber
            0: Movie(0, 831)   ' the 831 is the number of frames in MOVIE00.PMV.  you'd need to change this based on your movie size
            1: Movie(1, 888)   ' same thing for MOVIE01.PMV
            ' ... and so on for as many movies as you need
    
    If you want to select the movie based on a pushbutton, you'll need to provide more information about the number of pushbuttons, how they're connected, how you want them to behave if you hold the button in, etc.
  • Sheher AliSheher Ali Posts: 3
    edited 2012-11-11 09:31
    I'm looking to use 3 push buttons to activate the 3 movie files I want to display. For example, button 1 would be pressed and movie 1 would play. I want the buttons to work so that they do not have to remain held down in order for the entire movie to play. I want it to be a quick selection and the movie to play fully. The buttons are going to be connected into pins 5-8 for example and then when the signal is received the program will know when to select the movie files according to their assignment.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-11 10:33
    Do you understand how to use a pushbutton with the Propeller? If not, have a look at the section of "What's a Microcontroller?" that deals with pushbuttons. It's written for the Basic Stamp, but the idea is the same. We can't do your project for you, but we can offer you advice and point you to resources. Have a look at BS2_Functions in the Propeller Object Exchange. It provides much of the functionality of the Basic Stamps as method calls in Spin. It also serves as examples of things on the Propeller that are done as primitive operations on the Basic Stamp. Also have a look at the Propeller Education Kit Labs.

    Generally, a pushbutton is used to start something going, in your case a movie or sound file. You'd have an IF statement that would test for the pushbutton, then execute something like the Movie call shown above. You might have several IF statements, one for each button. When the Movie call is done, your program would repeat the IF statements that test for each of the buttons in turn.
Sign In or Register to comment.