Kaimana RGB LED Board thread, RGB animations and more! SRK Tech Talk 2013 Product of the Year!

OK so I downloaded brightstick code and I think I see the issue. You will need to insert the joystick line with the 0xff and have the sequence skip a number this is the way Jasen is handling it.

Say you have the joy between p4 and k1 so it would be

P4 = 4
Joy = 0xff
K1= 6

Enable all the leds again and set the joy as above, also delete the start home select lines if you don’t use them at all. And don’t mess with led_count until you remove the menu leds then you just subtract the number of leds (6) from the number in led count.

One last thing if it gets too crazy re-download a clean copy from brightstick.

But don’t I need the Joy set as a number for it to be included within the indexing?

Yes, you should set it to a number. Here’s why:

The logical test in the code first says “Hey, the joystick is being pressed… light up this LED” then it says “Hey, this button is pressed, light up this LED and the one next to it”. You can see this in kaimana.cpp:



  if(index == LED_JOY)
  {
    index = 8;
   _led[index].r = iR*BRIGHTNESS;
   _led[index].g = iG*BRIGHTNESS;
   _led[index].b = iB*BRIGHTNESS;
  }
  else
  {

     _led[index].r = iR*BRIGHTNESS;
     _led[index].g = iG*BRIGHTNESS;
     _led[index].b = iB*BRIGHTNESS;
     _led[index+ 1].r = iR*BRIGHTNESS;
     _led[index+ 1].g = iG*BRIGHTNESS;
     _led[index+ 1].b = iB*BRIGHTNESS;
   }


NOTE: This is the PFS2.0 specific code from the BrightStick site where the JOY is the 9th LED in the series ( but really indexed value of 8 because in programming arrays starts with 0). So for non Panzer installs (or installs that dont follow my PFS2 LED scheme) can remove the line:



index=8;


since you will set the LED index for LED_JOY properly. You could also just update that line to have the correct index number for your case, but that would be redundant. If you remove it though, the code will take the index value and use it properly lighting the LED up in the joystick.

Here’s what’s going on:

It has to do it this way (handle the JOY LED first in all cases, hence an IF->ELSE statemnt) because the LEDs are in series with two per button. If you just set the JOY to a number and follow the same logic it will light one of the LEDs on button A and then the next LED on button B for Kaimana Js installed after the JOYSTICK and nobody wants that.

In the case of the Panzer 2 setup, the first LED set in the string is for K4. So you have the single button:


  •     *
    
  • K4 *
  •     *
    

With the pair of LEDs under it:

(LED 0 --> LED 1)

The code I mention above says: set LED at position 0 to “R” “G” “B” values (with some brightness modification) and then set the LED one position down the line (in this case LED 1, which is the other half of the K4 button lighting and evident by [index+1] ) to the same value WHEN K1 is pressed.

Now… let’s think forward to K1 the JOYSTICK and P1. The LEDs are setup such that:

|— KICK 1—| | JOY | |—PUNCH 1—|

LED 6 --> LED 7 --> LED 8 --> LED 9 --> LED 10

With the code above, it does it right. You press one of the directions on the Joystick, the code senses those digital pins and says “Hey! Light up the LED Joy at this index and only at this one index”… so it passes the index number (via some complex code in the .ino file) to the block of code. Since the index is the JOY index it enters that first “if” statement and then lights up the correct LED completely bypassing the else statement like it didn’t exist.

Say, for example, we didn’t have that first “if” statement in there and the code within the “else” brackets was the only bit in this function…

It would pass the index for the JOY, 8 in our case, and light up LED 8 AND LED 9. So the JOY LED would light and then the bottom half of PUNCH 1’s Kaimana J would light up. WHOOPS!

Hopefully this demystifys some of the magic happening here.

So that’s where it is! I keep forgetting that brightstick is panzer specific also. Thanks for the info, another way in which we can play with this!

I have the skeleton of a generic j2 library in my github but need to get that board working!

Thats for the clarification.

Still leaves me confused though. I can only set the JOY to 0, as I don’t have the wires to put it anywhere else, and I don’t know of anywhere in the uk that would sell the required wires…

But as described earlier with JOY = 0, K4 = 1&2 K3 = 3&4 and so on round to P1 to P4, it seems like the indexing is right and the coding otherwise unmodified from brightcade, but the joystick didn’t change when pushed, and all the light buttons were one LED out of sync =/

Yet after testing as @JRDIBBS suggested, the JOY works fine when its the only thing plugged in =/

Did you remove the index=8 line as Jasen suggested? This line will override anything you put in unless you remove it.

@Kuniku - Can you tell us how you have everything connected. This will help us, help you, write the code. OR you could just wire it like a PFS2 and be done with it:

K4-K3-K2-K1-JOY-P1-P2-P3-P4-START-HOME-SELECT

I Agree here since it no longer exists as a response.

@“Jasen Hicks” Sure thing.

I followed the youtube video I mentioned in an earlier post with the guides on how to both install the kaimana mini and how to add rgb LED to the joystick.

My Layout/Setup

I don’t have a spare 4pin to J2 3 Pin connector, so am unable to put the Joystick anywhere but first in the series of LEDs.

So the indexing was done as follows:

Spoiler


P1 - 9
P1 - 10
P2 - 11
P2 - 12
P3 - 13
P3 - 14
P4 - 15
P4 - 16
JOY - 0
K1 - 7
K1 - 8
K2 - 5
K2 - 6
K3 - 3
K3 - 4
K4 - 1
K4 - 2
LED Count - 17


With the other buttons, home, sel, share, start or what not all just set to off with 0xFF and 0,0,0 colours etc

The colour coding itself was simply everything purple when nothing pressed etc, changing to yellow when pressed etc. With the standard idle animation numbers inserted

Yeah just removing the index=8 line would work for you. The code you put is not the one in the file right? They should be named P1_A and P1_B and so on so you dont get overwriting values.

A random realization with this code @“Jasen Hicks” is that you dont even need to declare the even (2,4,6…)LEDs since your code does the +1 anyways.

@JRDIBBS - correct. That being said, its good practice to do it IF you get more creative with the coding and start changing colors to mix them (top half is green, bottom yellow for example).

@JRDIBBS Thats not the actual code no, I’m at work so just wrote it out short hand. So don’t need to include the LED Count?

@“Jasen Hicks” I do plan to get more funky with the lighting, but wanted to get it working with the basics to begin with. Then I’ll start looking into learning how to do animations etc!

I’m still at a slight loss as to why if my setup and indexing is correct the LEDs aren’t playing ball.

On the off chance there was an error somewhere along the lines tomorrow morning I’ll redo the coding from scratch and see if it mysteriously works or not.

Thanks again for the help thus far!

Leave LED_count in and just remove the index=8 line in the other file. If it does not work do this:

*Setup and Redownload from Brightstick site
*Change the index order of the LEDS to match yours (changing the joyled to 0 also)
*Remove the index=8 line in the kaimana.cpp file

This should make it work. I hereby ban you from posting until you test! (not really but you know what i mean lmao)

@JRDIBBS Do you mean change the order of the buttons into the order of the LEDs rather than the order they come listed in as standard?

@JRDIBBS and @“Jasen Hicks” You’ll be pleased to know that everything seems to be working, I checked the wiring, added new code and hooked everything and up and apart from one tiny thing everything is working just fine.

That little thing is another odd one. One of the LEDs on P1 doesn’t hold its colour when the button is pressed. It works exactly as it should when nothing is pressed and during the idle animation. However if I press and hold the button one of the two LEDs turns yellow and stays yellow. However the second LED on that J2 only flashes yellow and then returns to purple.

Its not a huge issue as you tend to only tap buttons anyway, so I’m not overly fussed about it - but if I start messing with animations etc its probably something that I might want to look at… Any ideas?

Edit:

Urgh unwired it to actually install it and now the LED’s not lighting up again >_< will have to try and rewire it =/

Glad you got it working, sometimes it’s best to never put stuff in sticks. But hey once you install them you will NEVER take them out right? Keep it up and check out my too-much linked page HERE where you can find many examples of different setups and animations. I will be posting some guides in the near future but you can hack away at your hearts content in the meantime.

On another note, watch here how I drive a LED strip with the Kaimana! There are more vids in the channel that have the other idle animations working.

Spoiler

https://youtu.be/5BK6ie4BgEU

Thanks for the link, once I’ve got it up and running again I plan to start looking at animations.

Unfortunately I used some one time use terminals as the wires were too small to use the smallest barrier strips they sold, so I’ve had to wait until I could get back to my local electronics shop to buy some more. If the LED isn’t coming on at all would it be the VCC wire to check first?

We are going to make the unofficial official.

First off, HUGE thanks to @“Jasen Hicks” and @JRDIBBS for all their help. These two guys are great friends and kept the ship on course during the last several months I have been less available.

Now while Jasen is off keeping us safe from the evils of the world, we asked @JRDIBBS if he would like to join the PAS team officially and we are thrilled he accepted.

I have asked him to make sure we support the forums, but condense information here into a much more useful support page. Thank you again for all your help and thank you to everyone for their support.

Thanks Bryan and PAS!! I’m super excited to be working on the Kaimana since it has become a pet project of mine.

I’m now working on becoming the main support person for the Kaimana so If you have any questions fire away! Nothing’s really changed in here but we are revamping the support.paradisearcadeshop.com site with guides, videos and a lot of the info we have put here.

@JRDIBBS @armi0024 @“Jasen Hicks”

hey guys,

i have been working with the Kaimana Mini

http://paradisearcadeshop.com/4387-thickbox_default/paradise-kaimana-led-controller-pcb.jpg

and as you can see there is an ICSP header exposed (2x3 connector) which is cool, since @armi0024 created this as an OSH Project

i have a question about the Khameleon

as you can see, there is no ICSP header exposed, i’d like to know more about the schematics on this device for
[list=1]
[] loading new arduino bootloader
[
] skipping the bootloader all together and programming the board directly with a JTAG / Pocket AVR / ICE / AVRISPmkII / Whatever
[/list]

is there a pin breakout somewhere you can point me to?
you know, being a project based on an open source product (arduino) i should be able to flash whatever on to this?
pfft. warranty not needed