Little help please, new to the picaxe

curtis_1966

New Member
Guys I know this has been asked a million times already or its just a stupid question. I'm new to this picaxe, but I made a mistake in my program how do I fix the program on the chip.

Thanks guys
 

Rick100

Senior Member
Hello Curtis,
Please be more specific. Could you post your code and a description of the circuit and describe what he problem is? The more info the better.
 

erco

Senior Member
Use the Picaxe editor to modify your program and upload/reprogram your picaxe as many times as you like.
 

AllyCat

Senior Member
Hi,

If the PICaxe won't accept a new download (e.g. because your code contained a DISCONNECT command) then use the "Hard Reset" procedure, explained in the User Manual and many times on the forum.

Cheers, Alan.
 

westaust55

Moderator
Thanks guys for your help. I just reprogramed it with the picaxe downloader.
Do you mean:
(A) I had just programmed the PICAXE but cannot get the corrected program to download, or
(B) all is now well and I can download again!

Hopefully all is now well ....
In which case what solved your problem - that information may help other newcomers.
 

curtis_1966

New Member
The original program had a delay mistake in the command. Just Tried what erco said an all is good. Just redownload correct program an it overwrites. I guess, seems to work now.
 

curtis_1966

New Member
Okay guys, all you picaxe gurus. I have a different problem here an didn't want to post a new thread on this. I have searched the forum for an answer but with no luck.
I have purchased a 3axis skull kit for halloween went together very well with very little problems. Comes with a servo controller board with a MDFLY TL 322 MP3 board, being controlled by the Picaxe 14M2 chip. Came with a program to run everything, all I had to do was copy an paste. Went well besides my previous mistake of a delay time. Anyhow, my question is this, What would I have to do to make the MP3 card to play a ambient sound before the trigger which is a PIR. I'll include a part of the program here but only the lines that pertain to the MP3 card and PIR for which I don't know if the program has a copy write. Program as follows.......

Code:
#Picaxe 14M2

symbol TENDA=C.0
symbol PIR_IN=pinB.5
symbol PIR_COUNT=b5

start0:
         PAUSE 60000                      'Delay for PIR to warm up
         serout TENDA,4800,($EF);    'STOP mp3 module
         pause 500 
         serout TENDA,4800,($E7);    'SET MP3 volume
         pause 500
          
TESTIT:
           Do : Loop Until PIR_IN=1    'PIR debounce code
           
         Do

         PIR_COUNT=PIR_COUNT+1*PIR_IN
         Loop Until PIR_COUNT=10
         PIR_COUNT=0

         goto Routine 

ROUTINE:

              serout TENDA,4800,($01)   'Start playing first mp3
              pause 65355           'Delay is length of audio track(Is there anyway to increase this since track is 3min. long)
              for time=1 to 60      '60 is the number of seconds of retrigger delay(Can I increase this since track is 3min long)
              pause 1000                        'Pause for 1 second
              next time

goto TESTIT                                     'Return to PIR testing to restart proces
I appreciate any help I could get for this matter. Thank you all in advance.

C
 
Last edited:

westaust55

Moderator
It would be helpful to provide a link to the datasheet/manual for the MDFLY mp3 module you are using. A quick Google search did not find a hit with
"MDFLY TL 322 MP3". Please help us to help you.

What precisely do you mean by "ambient sound" ? This to me means a backgound sound, but do you want a continuous tone, a sequence of tones, a tune, or what?

Your code snippet has a couple of questions within that. Are you also seking answers there?
If so, does the MDFLY mp3 module have a "finished" output that you can use instead?
Otherwise you can cosider the WAIT command (this waits for seconds rather than milliseconds as the pause does).
 

curtis_1966

New Member
Oh wow, sorry about that. Its actually SD Card MP3 Player Module RS232-TTL here is a link: http://www.mdfly.com/index.php?main_page=product_info&products_id=284

And yes its a background track on the on the mp3 card, was up half the night reading the picaxe basic commands to see if I could make any since of the program thought that getting rid of the start0: part and start with the testit: instead. While waiting on PIR to trigger play the background track an then stop when pir does trigger then replay after routine: finishes. And on the questions inside the code kinda figured those out with a For b1=1 to 180: pause 1000: next b1. That is if I can use 180 there?
 

erco

Senior Member
I'm not familiar with that MP3 player, but it sounds like you want it to constantly play a default track, and switch to a different track when the PIR is triggered, then return to the default track afterwards. Is that right?
 

curtis_1966

New Member
Yes that is correct. thinking that the commands would have to come in the testit: part but not sure where or what command I understand the loop will run until pir_in=1. Heres what I got so far.

Code:
start0:

        for b1=1 to 60				   'Delay for PIR to warm up
        pause 1000
        next b1
        	
	serout TENDA,4800, ($EF); 		'STOP MP3 module 
	pause 500
	serout TENDA,4800, ($E7); 		'Set MP3 volume
	pause 500

TESTIT:
 
	 Do : Loop Until PIR_IN=1		'PIR debounce code
                
                Do
                PIR_COUNT = PIR_COUNT + 1 * PIR_IN
                Loop Until PIR_COUNT = 10
                PIR_COUNT = 0
                
	goto Routine
	
ROUTINE:

	servo B.1,center	
	servo B.2,center1 
	servo B.3,center2			
	resume 1				
	resume 2				
	resume 3			
	

	serout TENDA,4800,($01)       'Start playing first mp3
 	
 	for b2=1 to 149               	    'Delay is length of audio track
 	pause 1000
 	next b2
 	
 	suspend 1				
 	suspend 2				
 	suspend 3				
 	low B.1				
 	low B.2				
 	low B.3				
 	
	for time = 1 to 180		 'is the number of seconds of retrigger delay
	pause 1000 		 	'Pause for 1 sec 
	next time  	
	
goto TESTIT				'Return to PIR testing to restart process
 
Top