In the original program 'stay' has no effect. You gosub, do nothing then return to the place where you called 'stay' and resume. If you really intend to "go back to the beginning" you probably want to do that in the stay subroutine. In this post I think you intended MP3Play = 0 after the wend. Whitespace is your friend. Cheers -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu]On Behalf Of Alison Lewis Sent: Monday, May 16, 2005 5:15 PM To: piclist@mit.edu Subject: Re: [PIC] 16F876A + MBASIC + MP3 + FSR So I have the code working. I added a WHILE function in the "relayPlay" subroutine that only leaves the play routine if the number goes up a.k.a. the FSR is released, so it stays on play WHILE holding. It may not be pretty but it works. Yippee :) ------ CODE ------- relayPlay: MP3Play = 1 '''Play high c2 pause 20 low c2 pause 10 WHILE temp < 100 ADIN AN0,CLK,ADSETUP,temp ;keep checking A/D input pause 10 WEND MP3Play = 1 '''sets variable back to Pause RETURN ---------- END CODE ----------- ANOTHER QUESION: I made my own FSR out of Velostat. WHY do the A/D input numbers go up after each touch? It doesn't happen with store bought FSRs. HAND-MADE SENSOR OUTPUT: http://beard.dialnsa.edu/~lewisa/blogs/DMSpring2005/PIC_FSR--test2.gif ///ACL --- Alison Lewis wrote: > I am working on a project in MBASIC. Anyone use that > in this forum? I am not up to speed on any other > language, so please respond with help on the MBASIC > program for PIC16F Series. > > Below is what the program should do: > ----------------------------------------- > When the FSR is held down the MP3 Player should Play > When the FSR is not being touched the MP3 Player > should be Paused. > ----------------------------------------- > Seems simple enough, right? > I have good readings from the FSR 0-1023. > Consider any number < 100 as = touching the FSR. > I think of it like mouseOver or mouseOut in Flash, > but > instead its an FSR being touched not an icon in > Flash. > > I am using a simple digital relay and sending +5 > when > I want the pins to the MP3 player to connect. When > the > relay gets +5, then pauses, then goes back to ground > it opens and shuts the relay connected to the MP3 > pins. (very easy) > > So far I've only been able to make the FSR act like > a > button: release it and toggles PLAY, then the next > release it toggles to PAUSE. Back and forth it goes > toggling between the two options upon every release. > > But how do to continuous play? By continuous play I > mean, if it is playing AND it is being touched then > continue playing (no toggle). Below is what I have > done so far, BUT remember it doesn't work right it > works like a toggle button. Am I missing some > specific > code or variable? Help me see how to approach this > idea in MBasic. > > Thanks, ACL __________________________________ Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone. http://mobile.yahoo.com/learn/mail -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist