Running leds
Jack.Ruben
Posts: 8
Hallo,
wat is wrong on my program to create a running leds program?
Thanks,
··········· Jack
wat is wrong on my program to create a running leds program?
Thanks,
··········· Jack
Comments
I mean the leds wil first shift to the right and then go backwards(shift left) en so on.
(a Nightrider light)
Thanks Mike,
··················· Jack
···· Jack.
I could write the program for you, but you wouldn't learn much from that.
Since i'm also a newbee to the propeller, i took it as a challenge to solve Jacks problem. here is my version of the solution.
At least it works. However,i think there is much to improve. May be Mike or someone else can have a look at the code and tell me and Jack, what can be improved.
That's the way , we can learn to understand the propeller
OUTA[noparse][[/noparse]3..0] := %0101 ' Turns on LED's 0 and 2
OUTA[noparse][[/noparse]0..3] := %0101 ' Turns on LED's 1 and 3
Rather than have two loops, one could simply switch the startPin and EndPin numbers.
I can not find any clou that helps my further. Thanks anyway.
propelleruser999 and hippy thanks for the help.
··············· Jack.
http://elmicro.com/files/manuals/blink10.spin
Thanks you ferry mutch Deiloohay.
············· Jack.
yes, you solved it much more elegantly. you only have to set PinStart and PinEnd and everything else needed to run the program is calulated automatically.
Thats the way i wanted it too, but do to lack of enough experience with SPIN, i didnt came up with a good solution.
I'm a C programmer and still have to get more aquainted to SPIN, which has a c-like(or at least similar) syntax, but there are differences.
learned some new things,thanks.
This is my solution for this program.
Thanks to all.
······ Jack.
I thought that Nightrider special effect was cool ... gives a searching feeling. It has been on·some·movie-bots too.
Jack, Not that it matters, but you only need to use dira[noparse][[/noparse]5..0]~~ once in your program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley
Traffic is slow at times, but Parallax orders·always get here fast 8)
that fits your special 6 Led problem for specific pins , that the LEDs are connected. running more LEDs will have you to change all of your code.
the programs Mike and i have suggested , use variables in the VAR sections and
some code changes in your program.
with Mike's version:
once you decide to put your LED's on other pins ,or want to increase or decrease the number of LED's, you simply have to change
StartPin and EndPin in the VAR section and the program runs without changing your whole program again.
Think of a much bigger program ???
You want to change your SD-Card to another pingroup? Just change the start adress (you need no end adress for a SD-card adapter , its already known by your previous program, if programmed that way)
I don't know , if thats the only program you will ever write for the prop; then stay with that.