Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:04 07 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Led Star

Author Message
RonnS
Senior Member

Joined: 16/07/2015
Location: Germany
Posts: 121
Posted: 11:26pm 06 Sep 2016
Copy link to clipboard 
Print this post

sit back and have funnn

LedStar

i used a 2 meters APA LedStripe ,cutted every 12 leds, a MuP Board and a great Powersupply

to program i used a example from the Picaxeforun and BillB s Apa example
first i programmed each single led,next i putted all into a loop

Option autorun on
Option DEFAULT NONE
option explicit
cpu 48
randomize timer
Dim integer count, count1, counter,counterB, rndnum, loopcount, offset, w0, w10, w11,speed,Ledcounter2,Ledcounter1
Dim INTEGER HOW_MANY_LEDS=120
Dim integer red1, red,bgR
Dim integer green1, green,bgG
Dim integer blue1, blue ,bgB
dim integer LedCounterA,leds_armsA
dim integer LedCounterB,leds_armsB
dim integer LedCounterC,leds_armsC
dim integer BRIGHTNESS :BRIGHTNESS = 30
bgR=002: bgG=001: bgB=000
red1=250: green1=151: blue1=000



dim integer colours(28)=(003, 000, 227, 255, 000, 220, 059, 000, 199, 087, 000, 157, 115, 000, 145, 135, 000, 135, 059, 000, 199, 031, 000, 227, 003, 000, 255, 255, 000)
data 255,000,003,227,000,031,199,000,059,171,000,087,143,000,115,000,000,171,059,000,199,031,000,227,003,000,255,255,000,003, 227,000,031,199
data 000,059,255,000,003,227,000,031,199,000,059,115,000,000,171,059,000,199,031,000,227,003,000,255,255,000


SPI open 5000000, 3,8
speed=150
head
for w0 = 0 To HOW_MANY_LEDS
sendled 000, 000, 000
next
tail
Pause 100

Sub sendLed (red as integer,green as integer,blue as integer) ' Send a LED controlling command
SPI write 4, 225, blue,green,red
End Sub

Sub Head ' Send the start of data header
SPI write 4, &H00,&H00,&H00,&H00
End Sub

Sub tail 'Send the end of data tail
SPI write 4, &HFF,&HFF,&HFF,&HFF
End Sub

sub getcolour
red = Int(RND()*10)+1
red1 = red * 10 and 10 + 100
green = Int(RND()*10)+1
green1 = green * 10 and 10 +100
blue = Int(RND()*10)+1
blue1 = blue * 10 and 10 +100
rem print blue1;green1;red1
end sub


PowerOnReset:
do
count1=0
do
count1=count1+1

LedcounterB=11
LedCounterA=0
'first segment

for counter=1 to 11 step 2
ledcounterA = ledcounterA + counter
LedCounterB = LedCounterB - counter
pause speed
head 'from the middle to the ends

for loopcount = 0 to 4 ' loop 5 time for the arms

for w10=0 to LedcounterB
sendled 002, 001, 000
next
for w11=1 to LedCounterA
sendled 210,105,030
next
for w11=1 to LedCounterA
sendled 210,105,030
next
for w10=0 to LedcounterB
sendled 002, 001, 000
next

next loopcount
tail
next counter
loop until count1 > 2

do
count1=count1+1

LedcounterB=11
LedCounterA=0
'first segment

for counter=1 to 11 step 2
ledcounterA = ledcounterA + counter
LedCounterB = LedCounterB - counter
pause speed
head 'from the middle to the ends

for loopcount = 0 to 4 ' loop 5 time for the arms
getcolour
for w10=0 to LedcounterB
sendled 002, 001, 000
next
for w11=1 to LedCounterA
sendled red1,green1,blue1
next
for w11=1 to LedCounterA
sendled red1,green1,blue1
next
for w10=0 to LedcounterB
sendled 002, 001, 000
next

next loopcount
tail
next counter
loop until count1 > 20

rotate:

count1=0
leds_armsA=12:
leds_armsB=12
LedcounterB=12
LedCounterA=1
counter=1

do
getcolour
count1= count1+1
head 'first arm 0
for w10=1 to 12
sendled red1,green1,blue1
next
for w11 = 13 To HOW_MANY_LEDS-12
sendLed bgR, bgG, bgB ' to last = Off
next
for w10=HOW_MANY_LEDS-11 to HOW_MANY_LEDS
sendled red1,green1,blue1
next
tail

for counter=1 to 9 step 2
ledcounterA = counter*leds_armsA
counterB=counter+2
LedCounterB = counterB*leds_armsB
head 'second arm 1
for w11 = 1 To LedCounterA
sendled bgR, bgG, bgB
next
for w10=LedCounterA to LedCounterB
sendled red1,green1,blue1
next
for w11 = LedCounterB To HOW_MANY_LEDs
sendled bgR, bgG, bgB
next
tail
next
rem leds_armsA=12:leds_armsB=12:LedcounterB=12:LedCounterA=1:counter=1
pause speed
loop until count1>20
loop

the diameter is about 50 cm

 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 03:17am 07 Sep 2016
Copy link to clipboard 
Print this post

Nice job! That looks great!
Micromites and Maximites! - Beginning Maximite
 
RonnS
Senior Member

Joined: 16/07/2015
Location: Germany
Posts: 121
Posted: 04:21am 07 Sep 2016
Copy link to clipboard 
Print this post

thank you very much CG ...

PS:can you publish on your pageEdited by RonnS 2016-09-08
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 05:30am 07 Sep 2016
Copy link to clipboard 
Print this post

I love it
 
RonnS
Senior Member

Joined: 16/07/2015
Location: Germany
Posts: 121
Posted: 06:06am 07 Sep 2016
Copy link to clipboard 
Print this post

thank you lew247 :)
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 06:53am 07 Sep 2016
Copy link to clipboard 
Print this post

As I said before - great work.

So how did you get that high quality music out from the MicroMite (i'm sure it wasn't on the video you emailed me before!)

And it is real good of you to post your code for others to 'learn' from - much appreciated

Bet Christmas at your house this year will be 'bright'!
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 07:17am 07 Sep 2016
Copy link to clipboard 
Print this post

  RonnS said   thank you very much CG ...

PS:can you publish on your page


Yes! Thank you.
Micromites and Maximites! - Beginning Maximite
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 02:53pm 07 Sep 2016
Copy link to clipboard 
Print this post

Hi RonnS,

Haven't been here for a while but when I get the opportunity, I keep checking in. As a new member to this awesome forum, you have presented a nice piece of code. I know BillB set the framework and did a fantastic job with his Christmas display (beyond awesome), when someone like you and BillB spends a little time and effort to show the rest of us some awesome working code, it is very valuable. I actually spend a bit of time looking for gems like this and save them in my own little library. You and Bill are published authors in my library. (amongst MANY other GREAT members). Great work and keep them coming. Geoff has created a VERY special tool for us to open up a world of possibilities that would have never been possible before. The forum members here (you included) take the amazing capabilities Geoff has provided with no cost to us and expand on an seemingly unlimited journey! Again, great work, keep it coming, please!

A big thanks to everyone here. I have learned soooo much from TBS, I wish the rest of the world worked like this!

I have a feeling RonnS will have guru status before we know it....

 
Bill.b

Senior Member

Joined: 25/06/2011
Location: Australia
Posts: 235
Posted: 12:45pm 08 Sep 2016
Copy link to clipboard 
Print this post

Hi Ronns

Great Stuff,

I have been developing a new ride for my Christmas carnival and will
post info when it is completed.

I am using both apa102 and apa104 led strips and 2.8" LCD display with both picaxe and micromite controllers.

Bill
In the interests of the environment, this post has been constructed entirely from recycled electrons.
 
RonnS
Senior Member

Joined: 16/07/2015
Location: Germany
Posts: 121
Posted: 08:40pm 08 Sep 2016
Copy link to clipboard 
Print this post

Many thanks for all the positive comments...

hi Bill...I am interested in this project---

please tell me what is the difference between apa102 and apa104

thanky you Ron
 
Bill.b

Senior Member

Joined: 25/06/2011
Location: Australia
Posts: 235
Posted: 02:13am 09 Sep 2016
Copy link to clipboard 
Print this post

The APA104 is equivalent for the WS2812 which required very specific
timing to address the LEDs

See http://www.thebackshed.com/forum/forum_posts.asp?TID=7420&PN=1

Bill
In the interests of the environment, this post has been constructed entirely from recycled electrons.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025