cylon eye sound
wirecutter
Posts: 22
does anyone have the code to create the cylon eye sound from the old series using 1 cog.
I was thinking of freq syth, as opposed to using a SD card.
wirecutter
I was thinking of freq syth, as opposed to using a SD card.
wirecutter
Comments
Definitely do-able!
Rayman has posted code for running soundfiles out of hub memory, so you could be up in minutes ...
Here's the link from another thread:
http://obex.parallax.com/objects/324/
Regards,
T o n y
In my version you can call the playsound() method with the pin to use for output, the address of an embedded WAV (8-bit, mono) file, and the number of times to play. If you set plays to 0 it will loop forever.
The ZIP includes the project file and several versions of the WAV. The 22K sample (original) is too big to embed.
been awhile since I been here. back to my project. I have the code from jonnyMac, its great. can someone replace the LED control section of the file "jm_Demo_Board_Cylon.spin" with this code (I don't know how to post code here yet:frown:). So I can get the 32 LEDs to sweep back and forth.
Thanks a bunch,
wirecutter
any help out there? I have tried several things but it always end up not working.
thanks,
wirecutter
my opinion about this forum is to learn. Not to ask for completed solutions.
If you provide your code I will take a look inside and explain what's wrong and how to correct it.
In the propellertool Choose from the mainmenu File - Archive-Project... and this will create a zip-file with all files that are nescessary to compile the code.
Then you have to attach this code. Click on the "Go Advanced" button and upload the zip-file
best regards
Stefan
Thanks for the info on posting code, just something else I needed to learn.
wirecutter
Attached is the latest code. this one only clicks, no lights, no sound other than repeat clicks. Perhaps I am still thinking on a DOS logic system, and not parallel processing. I seem to be able to get them to work as separate programs, but not together. what I am trying to do is to have the LED controller in cog0, and the wav player in cog1. perhaps its the cognew command? perhaps I am over designing again?. I am thinking of trying to separate the controls, and treat them as 2 parts instead of one. I am so confused :blank::depressed:
My hardware; 4 banks of 8 LEDs, common ground for each bank (see pic).
There is 32 Leds total, P27-P20 control each LED in the bank, P19-P16 control which bank(module) is selected.
The drive sequence:
step 1.. P19 is high as P27-P20 sequence.
step 2.. P18 then goes high and P27-P20 sequence again
step 3.. P17 then goes high and P27-P20 sequence again
step 4.. P16 then goes high and P27-P20 sequence again
sequence reverses...
step 5.. P16 then stays high and P20-P27 sequence
step 6.. P17 then goes high and P20-P27 sequence again
step 7.. P18 then goes high and P20-P27 sequence again
step 7.. P19 then goes high and P20-P27 sequence again
Schematic You show in Yours post I think are not correct. If left side of it are same as Propeller ProtoBoad connector -- Last hole You have as small rectangle are +3.3V - hole before are GND.
NEXT -- Never use LED's with Propeller without Current limiting resistors.
Once I saw the correct patterns in PST it was easy to create a method:
Easy-peasy. Now... I don't like to embed "magic numbers" in code but as you've defined them, they are in the method. The method also takes care of setting those pins to output mode.
PS: Once you've modified code I've written for you -- as you have here -- please remove my name or use "based on code by..." so that I'm not held responsible for your changes (I have enough of my own trouble! <wink>).
Sapieha, actual connection to the propeller is through resisters and NPN transistors. Attached is schematic if it helps. if it also means anything I am using the Propeller Professional Development Board, to work on the programing. The schematic is the final controller board that will be placed in the finished helmet.
On last SCH -- It looks You have Propeller connected to RG1= 7805 = 5Volt -- Not good.
Propeller are 3.3V device.
Next -- Have connections to all GND, VCC-3-3V pins on propeller ---> important
JonnyMac, where did you get the "term.tx(CLS)" and the other lines like that?
I don't remember seeing the "term.XXX" in the propeller manual or the book I have on programing with spin.
could you explain this line of code??
" WavCog := cognew(playsound(10, @Cylon, 1), @stack) + 1 "
and do I replace the entire PUB main block with the second code?
where would I start to learn to output to a terminal (or are you referring to a demo board) for experimenting?
sorry for all the big questions
wirecutter
My schematic is wrong :frown:
my circuit capture program don't have the 3.3 volt regulator, so don't take the actual labels as fact. 3.3 volt to propeller, and 5 volt to LED transistors, and will be 10K ohms resistors between prop and transistor base.
wirecutter
In my program (attached) term is a serial object (fullduplexserial) and CLS is a constant for clearing the terminal window. You might want to start with the Propeller Education Kit Lab manual as it uses PST for output on most projects.
I could but I won't becuase you can lookup cognew in the manual and my source code is commented.
No, that's a routine you insert into your application.
As I indicated above, PEK Lab manual (download from Parallax) is a good place to start. The terminal program I'm using for my Propeller exeriments is PST (download from Parallax).
You can also find the Propeller Education Kit Labs under the "Help" menu of the Propeller Tool.
Jon has written some great artilcles for Nuts and Volts about programming the Propeller. Here's a link to the articles.
Duane
time for more reading.
wirecutter
I hope you haven't given up on your project.
I'm always hesitant to post code I haven't tried out myself but here I go anyway.
Cylon32.spin
I've changed Jon's code to control a 4 x 8 LED array (I think). From your schematic, it looks like the cathodes start with pin 16 and end at pin 20. The anodes start at pin 21 and end with pin 27. Right?
I tried to keep the end LEDs from being on twice as long (since Jon did it that way).
I moved the launching of the sound cog to outside of the main loop and set it to continous play.
I don't use sound much myself yet, so I doubt I'll be much help if you have trouble with that part of the code.
Let me know if the LEDs don't blink the way you want.
It takes a bit to get ones head wraped around the Propeller but it's well worth the effort.
What transistors are you using in your schematic? Are you sure they will work the way you intend?
Do you have details on these LEDs? If they are relatively low power and you only need one at a time, you might not need the transistors. (The code I'm posting assumes you do have the transistors. It would need to changed to drive LEDs directly.)
You can also control multiple LEDs with shift registers.
Good luck,
Duane
... all you have to do (from Main) is this:
Here's the updated program -- note that I had to test on my demo board so it may need some tweaks.
-- jm_Cylon_32Leds.spin
If he wanted to get fancy and support multiple pins on at the same time he could launch (with cognew) this multiplexer cog:
With this one would pass a long (mask) that defines which bits are on (1) or off (0).
Some how I forgot you already had fixed it for him. (How did I forget "Easy-peasy"?)
Sorry about that.
I'll have to look up a couple of items in your newer code. I don't understand all of it. (But I will.)
Duane
Duane Degn, I haven't given up on the project yet. I am still learning and I have a long way to go.
I will have to wait till I get home to check the code, thanks jonnymac and Duane. I am currently reading the lab manual. The terminal program is that the one that came with the propeller tool? any manuals to help with it, other than the lab manual?
thanks,
wirecutter
Had a chance to work with the new code from Jon and Duane. Jon's code works great. Duane's code worked but with only 4 LEDs out of the 8 in sequence, but it is repairable. I would like to thank everyone for the help. Now its back to the books and tear into Jon's code.
wirecutter
I have been researching to find out how to use a potentiometer to control the speed of LED sequence in my project. The pot is on P5, and is a 10K with a .1uf capacitor. I attached the code I am using for this project, thanks Jon. In this line "delay := clkfreq / 1000 * (1507 / 32)" I believe the "1507" controls the speed of the LED sequence, raise to slower the speed. Anyone have a OBJ to do this?
Edit.. I forgot to add that I have the RCTime OBEX and I am currently studying it.
thanks
jm_Cylon_32Leds - Archive [Date 2011.02.07 Time 14.20].zip