It's real good I was playing with the timer and events which made two tones
was going to try the swordfish user module. But then Mike post his random number generator code it a lot easier then the module.
MrDEB I think that will run them off just hook your pir to Rb0 Mike code change real good I tested it with this add a toggle to his code just to see how it would sound with the pir hooked there
Code:
While(TRUE) //repeat forever
toggle (portb.0)
delayms (250)
If PORTB.0=0 Then //if button 1 pressed
For i = 1 To 10 //play 10 tones
Tone=Rand(5) //each tone is random frequency
DelayMS(250) //and for 0.25 seconds
Next //end for loop
Else //otherwise
Tone=5 //silence
i=Rand(255) //make rand more random
EndIf //end if condition
Wend //end of while loop
End
the code Mike posted (pretty sure all is there)
I press sw 1 on juney (RB0) and little juney plays notes
not very loud but sounds pretty random
i'll figure out how to make it longer, perhaps 3x longer as well as louder for sure.
All them deer may be hard of hearing, yea right
I don't have a junebug I was using my pickit2 and a 18f1220 with a speaker
hooked to it like showed MrDEB. So just toggled it to see how it would sound with the PIR going off on portb.0 Thanks for the code Mike. The number part will come in handy.
My wife can hear it and she was watching judge Judy three rooms over from me wanted to know what the H is going off in the house. lol He should be getting all his speaker can handle. If he driving it like I showed him
I changed the
For i = 1 To 10 //play 10 tones
to i=1-20
nothing comes out of speaker
changed back to 10 and it then works
changed DelayMS(250) //and for 0.25 seconds
DelayMS(1000) //and for 1.00 seconds
nada, no sound
changed back to 250 and it works
summthung not right??