Sample code needed for LED strobe pattern
BallNmIKE
Posts: 7
I would like some help in designing some code for control of 4 LED's Red Green Blue and White. I would like multiple functions with the push of a button. and flash/strobe speed control with a pot. I would like to choose a single color for strobe/w speed control. A few different defined patterns. Like chase, alternate, fade.·All with only 1 button and 1 pot.·Thanks!!·
Comments
1) 4 LEDs separately controlled (each by one I/O pin). Since the LEDs are of different types, they will need different value resistors for the same level of intensity. How would you figure that part out? Hint: You need to know the voltage drop (forward voltage) of each type of LED and you need to use Ohm's Law.
2) You need a pushbutton switch on another I/O pin and a pullup or pulldown resistor. There are examples of both #1 and #2 in the "What's a Microcontroller?" tutorial and the "BASIC Stamp Syntax and Reference Manual", both downloadable from Parallax and included as part of the help files with the Stamp Editor.
3) You need a pot and code to read it. There are examples in the documentation on the RCTIME statement
4) Next steps are to try to light the LEDs in whatever patterns you want. The details depend on the patterns and how you've hooked everything up. You should end up with subroutines for each pattern that have speed (time delay) information in a variable so the pot can be used for a speed control.
5) Last step is to figure out how you want the push button to behave for selecting the pattern to show. There are many ways to do this. You propose something.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
This is not real code but the idea is valid.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
(By The Way)····· (·BTW )·the two Example can be found in the Basic Stamp Editor in the BS2 folder
You might also read ( What Is A Micro Controller ·)<<<<< ( Click Here )
If I where you I would read and do all of the Example in this book before I would start this project· here is why
First
It will help you understand how to write basic code
Second
It will help you Understand how to hook different thing to the Basic Stamp Pins
These are the most Inportant thing to underdtand in how to use a Basic Stamp
I hope this helps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 1/23/2010 6:36:47 PM GMT