Stupid, but Patriotic project for her majesty's jubilee
Britannicus
Posts: 98
This project only started on Monday - and here it is on Friday finished ....
My son came home from school "Dad - we've got a competition for the Queen's Jubilee" - We've got to make a crown.... there is a prize for the most ingenious! ( for those non members of the commonwealth it's the 60th aniversary of the Queens coronation - and we get a public holiday).
So we thought about what we could do ... and this tasteful and understated little confection was the result.
The final result utilises some old christmas lights rigged to a separate 9V battery and, for speed of development a BOE with an onboard 9V
1/ 2 Servos linked to servo ports 14 and 15 - one operates a home-made continous rotation servo and the other a mini servo - these drive the waving hand and the rotating union jacks
2/ A speaker between pin 9 and earth programme
3/ finally a switch rigged to set pin 3 as high or low
The programme is simple enough - ( thanks Duane Degne by the way for the de-bugging help) :thumb: :thumb:
My code goes like this :
1/ sits in a loop waiting for a high on pin 3
2/ Goes to a loop to play "God save the queen"
3/ .finally activates the servos before returning to the loop. Warning this does devour 9v batteries
In the unlikely circumstance that anyone should wish to repeat such an exercise here's my code (extensively poached and adapted from "what's a microcontroller" )
My son came home from school "Dad - we've got a competition for the Queen's Jubilee" - We've got to make a crown.... there is a prize for the most ingenious! ( for those non members of the commonwealth it's the 60th aniversary of the Queens coronation - and we get a public holiday).
So we thought about what we could do ... and this tasteful and understated little confection was the result.
The final result utilises some old christmas lights rigged to a separate 9V battery and, for speed of development a BOE with an onboard 9V
1/ 2 Servos linked to servo ports 14 and 15 - one operates a home-made continous rotation servo and the other a mini servo - these drive the waving hand and the rotating union jacks
2/ A speaker between pin 9 and earth programme
3/ finally a switch rigged to set pin 3 as high or low
The programme is simple enough - ( thanks Duane Degne by the way for the de-bugging help) :thumb: :thumb:
My code goes like this :
1/ sits in a loop waiting for a high on pin 3
2/ Goes to a loop to play "God save the queen"
3/ .finally activates the servos before returning to the loop. Warning this does devour 9v batteries
In the unlikely circumstance that anyone should wish to repeat such an exercise here's my code (extensively poached and adapted from "what's a microcontroller" )
' {$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,4WholeNote CON 2000index VAR Byteoffset VAR NibnoteLetter VAR BytenoteFreq VAR WordnoteDuration VAR Wordcounter VAR Wordwave VAR WordIN3=0'SITS HERE UNTIL IN3 IS POSITIVEDODEBUG ? IN3IF (IN3=1)THENDEBUG "OFF i GO"GOTO ACTIONELSEPAUSE 100ENDIFLOOPACTION:' FIRST SECTION PLAYS GOD SAVE THE QUEENDO UNTIL noteLetter = "Q"READ Notes + index, noteLetterLOOKDOWN noteLetter, [ "A", "b", "B", "C", "d","D", "e", "E", "F", "g","G", "a", "P", "Q" ], offsetLOOKUP offset, [ 1760, 1865, 1976, 2093, 2217,2349, 2489, 2637, 2794, 2960,3136, 3322, 0, 0 ], noteFreqREAD Durations + index, noteDurationnoteDuration = WholeNote / noteDurationFREQOUT 9, noteDuration, noteFreqindex = index + 1LOOPnoteLetter = "A"index=0'SECOND SECTION WAVE THE HAND use port 14 - use port 15 for the continuous servoFOR wave = 1 TO 4DEBUG "Counterclockwise 10 o'clock", CRFOR counter = 1 TO 50PULSOUT 14, 1000PULSOUT 15, 1000PAUSE 20NEXTDEBUG "Clockwise 2 o'clock", CRFOR counter = 1 TO 50PULSOUT 14, 500PULSOUT 15, 1000PAUSE 20NEXTDEBUG "Center 12 o'clock", CRFOR counter = 1 TO 50PULSOUT 14, 750PULSOUT 15, 750PAUSE 20NEXTDEBUG "All done."NEXTRETURN
Comments
-Phil
Good luck!
James came back from the competition - we won ! is there no end to the versitility of the basic STAMP ?!
:thumb::thumb::thumb::thumb:
A clean sweep actually as my wife won the cake competition - way to go Ann ! ( Jolly good show I should say ! )
Pretty good stuff eh! - tasted good too
Enjoy your long weekend.
Jim
-Phil