Patriotic problem _ I so need your help !
Britannicus
Posts: 98
As some may be aware this weekend sees the 60th Aniversary of queen Elizabeth II god bless her !
As such all us limeys will be having a public holiday and generally making a fool of ourselves. My son's contribution to this has been to enter him and myself into his school's "make an amusing crown" competition and has challenged his dad to make the most over the top confection he can (we have to build it together - he has to model it!) . I will post video of this when it's finished !
So far it lights up, and has a hidden BOE instde it where my trusty STAMP2 controls a speaker and 2 servos (one continuous rotation with union jacks and one to oscilate, waving a cardboard hand). The BOE sits in a monitoring loop until a switch turns pin 3 live. Then a speaker plays God save the queen, the servos do their stuff, and then it returns to the loop again.
Now here's the glitch - first time through the loop the damn thing works as predicted, the second time, just before "God save he queen is played", theres a godawful screetching before it settles down and does it's stuff. I'm guessing there's something I need to clear down after the tune plays the first time, but not sure where the issue is ...
Please help because this is most disrespectful to our monarch, and I might end up feeding the corgis ! (or worse disappointing my son)
I' ve attached the code as well as outlining it below - please help as he's got to be wearing it in a school pageant on Friday !
As such all us limeys will be having a public holiday and generally making a fool of ourselves. My son's contribution to this has been to enter him and myself into his school's "make an amusing crown" competition and has challenged his dad to make the most over the top confection he can (we have to build it together - he has to model it!) . I will post video of this when it's finished !
So far it lights up, and has a hidden BOE instde it where my trusty STAMP2 controls a speaker and 2 servos (one continuous rotation with union jacks and one to oscilate, waving a cardboard hand). The BOE sits in a monitoring loop until a switch turns pin 3 live. Then a speaker plays God save the queen, the servos do their stuff, and then it returns to the loop again.
Now here's the glitch - first time through the loop the damn thing works as predicted, the second time, just before "God save he queen is played", theres a godawful screetching before it settles down and does it's stuff. I'm guessing there's something I need to clear down after the tune plays the first time, but not sure where the issue is ...
Please help because this is most disrespectful to our monarch, and I might end up feeding the corgis ! (or worse disappointing my son)
I' ve attached the code as well as outlining it below - please help as he's got to be wearing it in a school pageant on Friday !
' {$STAMP BS2} ' {$PBASIC 2.5} ' Play the first few notes from god save the queen. ' speaker connects to pin 9 and Vss DEBUG "Program Running!" Notes DATA "C","C","D","B","C","D","P","E","E","F","E","D","C","P","D","C","B","C","Q" Durations DATA 4,4,4,2,6,6,8,4,4,4,2,6,6,8,4,4,4,4 WholeNote CON 2000 index VAR Byte offset VAR Nib noteLetter VAR Byte noteFreq VAR Word noteDuration VAR Word counter VAR Word wave VAR Word IN3=0 'SITS HERE UNTIL IN3 IS POSITIVE DO DEBUG ? IN3 IF (IN3=1)THEN DEBUG "OFF i GO" GOTO ACTION ELSE PAUSE 100 ENDIF LOOP ACTION: ' FIRST SECTION PLAYS GOD SAVE THE QUEEN DO UNTIL noteLetter = "Q" READ Notes + index, noteLetter LOOKDOWN noteLetter, [ "A", "b", "B", "C", "d", "D", "e", "E", "F", "g", "G", "a", "P", "Q" ], offset LOOKUP offset, [ 1760, 1865, 1976, 2093, 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 0, 0 ], noteFreq READ Durations + index, noteDuration noteDuration = WholeNote / noteDuration FREQOUT 9, noteDuration, noteFreq index = index + 1 LOOP noteLetter = "A" 'SECOND SECTION WAVE THE HAND use port 14 - use port 15 for the continuous servo FOR wave = 1 TO 4 DEBUG "Counterclockwise 10 o'clock", CR FOR counter = 1 TO 50 PULSOUT 14, 1000 PULSOUT 15, 1000 PAUSE 20 NEXT DEBUG "Clockwise 2 o'clock", CR FOR counter = 1 TO 50 PULSOUT 14, 500 PULSOUT 15, 1000 PAUSE 20 NEXT DEBUG "Center 12 o'clock", CR FOR counter = 1 TO 50 PULSOUT 14, 750 PULSOUT 15, 750 PAUSE 20 NEXT DEBUG "All done." NEXT RETURN
bs2
2K
Comments
I will give that a go - I thought it was something not being re-set but couldn't see what it was
Many thanks Andrew
Tried your fix - worked fine - I've now posted the result on Youtube
https://www.youtube.com/watch?v=oKMTkQAE4A4
posted the project in the project forum
http://forums.parallax.com/showthread.php?140429-Stupid-but-Patriotic-project-for-her-majesty-s-jubilee&p=1101979#post1101979
THanks for your help
C.W.