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

@ZonbiPanda just one Kaimana wired to two MC Cthulhus. I renamed a bunch of code in regards to the stick directions and basically nullified the aspect that make them detect like stick movement. Perhaps I missed something. But in terms of actual function it works just fine aside from this weird thing. I’ll be home soon and post my full code.

@ZonbiPanda code is in spoiler.

Spoiler

http://www.mediafire.com/download/yxj6ls9597289fx/dualvewlix.zip

@Zensouken Not sure if I’m reading your problem correctly, but I noticed in your vid that on the P2 side some button combination presses triggered your P2 Start to light up. If that’s the problem, unplug and replug the Kaimana harnesses of the buttons that are impacted. I had the same thing happen to me and I found that adjusting the harnesses in the chain helped me fix the problem.

@liquidcourage It’s like any four buttons pressed at the same time of a certain range of buttons causes all buttons in that range to illuminate. It’s kinda weird.

Does this happen when you load the original code or just with the modified code?

There is a bit of code checking for who is the current assist but that shouldn’t prevent you from flashing a button. I placed that code in a separate subroutine so it would be easy to find and copy out (hopefully).

The first line of code in this function does all the heavy lifting:



// button flah routine based on timer so it is can be called from other loops without "restarting"
void buttonflash(uint16_t attackButton, int R, int G, int B, int speed) {
  float val = ((exp(sin(millis()/1500.0*speed)) - 0.36787944)*108.0)/255;
  kaimana.setLED(kaimana.getLEDIndex(attackButton), R * val, G * val, B * val);
}


The second line of code has a call to determine the LED index of a given input but that could easily be hardcoded instead. I assume you would want to hardcode it because it appears as though you are writing your code within the main loop. The tricky part is getting your code to recognize that P1 has been held for X seconds while you are putting in all sorts of other button inputs and lighting those buttons up as well during those X seconds. Once I got 1 button flashing I realized it was just too big a pain to implement for multiple buttons without a history that included some sort of time stamp on every entry.

If you want a flash (square wave) or some sort of fade on or fade off (sawtooth wave) then you would adjust the math there used to determine brightness. Swap sin for cos in a different version if you want 2 buttons to flash in different phase but at same speed etc.

@ZonbiPanda @armi0024 @liquidcourage @wahoo747 None of you are gonna believe this but I figured out something weird. So the problem persists but ONLY when I have the Kaimana plugged in to the Arduino environment for testing. If I have the PS3 on then it functions normally. I guess that means it’s fine but it’s the only thing that acts differently if it’s connected to the computer rather than the PS3.

Also, @wahoo747 I’m looking at your code and I uploaded it into my Kaimana (I really like the assist tag animations) and I’m wondering if you can tell me how to assign the button flashing without being tied to the assistIndex in the marvel base code?

@Zensouken, the issue may actually have to do with the limitations on USB power on the computer. It seems that the PS3 and Xbox supply more power than a standard computer…

More importantly… post movies of it working! :slight_smile:

Just realized i forgot to get the screw terminals. Is that essential or is there a work around? My 1st time doing anything like this so the easier the better hah. Also really appreciate pre drilling the balltop for me that was a nice little surprise when opening up the box ~~~

Two questions…

1.) Can you solder?
2.) Do you want mostly permanent connections?

1.) No but i figured id watch a couple of videos and hopefully pick up on it(Maybe =O )
2.) Yeah once its in im good with it staying. As long as i can still mess with animations and what not then yeah im fine.

Well then, I say get a soldering kit and get some practice in and you should be fine as long as you take your time with it and make sure you aren’t interrupted in the process.

You can use .100 pin headers and just strip and crimp wires. Or you can return it and exchange, we are happy to swap it out.
-Bryan

Oh alright cool thanks ! I will try and make this decision before the days done =D.

Well, just add that subroutine or one like it to your code and whenever you want a button to flash you call the sub. As it is, the function expects the first parameter to be the switch Activity flag (ATTACK_P1, ATTACK_K4, etc), but can easily be changed to use the LED index. That would probably look something like (untested)


// button flah routine based on timer so it is can be called from other loops without "restarting"
void buttonflash(int LEDIndex, int R, int G, int B, int speed) {
  float val = ((exp(sin(millis()/1500.0*speed)) - 0.36787944)*108.0)/255;
  kaimana.setLED(LEDIndex, R * val, G * val, B * val);
}

Also the speed parameter is how fast it flashes, and numbers between 1 and 10 work well but numbers outside of that range do work, so play around with it.

So with that change you might use something like this to flash the buttons (taken from Zonbi’s snippet)



<snip>
// test switch and set LED based on result
if( (!digitalRead(PIN_P1)) && (!digitalRead(PIN_K1)) ) {
	switchActivity |= ATTACK_P1 | ATTACK_K1;
	// flash button
	buttonflash(LED_P1, WHITE, 5)
	buttonflash(LED_K1, WHITE, 5)
	iLED[LED_P1] = true;
	iLED[LED_K1] = true;
}
<snip>


I’d lose the “else” branch of these multi-button checks too, fyi. It is setting the button status and LED to “off” for both buttons even while one or the other button could be active. That could cause conflict with the single-button check code you have written for those buttons depending on which check happens first and wind up making your history incorrect.

@wahoo747 I tried and tried implementing your examples into the original example code but kept striking out. So in turn I spent the last few days hijacking your code and finally getting it function correctly. It’s heavily modified and more likely stripped down to the least amount I could without breaking it but it’s working in an acceptable fashion. Thanks for your very informative help, I definitely learned a whole lot. Here’s my (yours) hijacked code and a showoff vid for @armi0024

Spoiler

http://www.mediafire.com/download/s3yairpkb4j16gg/dualvewlixpulse.zip

Spoiler

http://youtu.be/_ukKYZGRtFo

Very cool. I like how you used 3 different flashers (speed/color) for the same button so it could “power up” a couple times as you held it. Nice. And no amount of explaining could have made that work in the master code. Making a button flash is easy but the history changes needed to do what you are doing now with the hold stuff would just take forever to explain and debug via a forum.
And now that you have pulled your LED code out of the pollswitches loop you can set up another color profile or new loadout completely and add it to the menu if you want. With LED light code inside the poll loop you are really tied to a single loadout (unless maybe you want a separate poll loop for each loadout but I’m not sure I can think of a legit reason to duplicate code in the sketch like that, space is limited).

I wanted to get the button flashing to match up with Zero’s charge animation but after screwing with timing I realized that as the code is now, this visually looks the best. But I might screw with it some more for the hell of it. Also, I was thinking about building more loadouts for specific games, UMvC3, USFIV, MvC2, CvS2, 3S, etc., so I’m really glad and impressed with the menu function and will attempt it once I get a second wind from programming this loadout. Ignored my Asian wife and half-Asian child right after Christmas and went straight at it until I got it working. Can’t even play with it at the moment. >_<

Time for me to go be a family man for now.

I’m getting ready to jump on the Kaimana train. Anyone know if any of the inserts work with the Gamerfinger HBFS buttons? Or should I just go straight for the Pele LEDs?

Go Pele’s, the inserts will not work and the silent pads will block under mount. But the Pele’s work fine!

Hello friends, this is my first post and i have lot of questions about kaimana, i hope u can help me.

First of all excuse my english, im from Spain and generally we dont have a good level of english, but i hope that will be enough :slight_smile:

Ok, i have the cabinet shown in my avatar, space paranoids :slight_smile: with mame and two players ready. Everything works well, it has basic led buttons but they are hard and i dont like them very much, so i will change them for sanwa clear 30mm. and i want to iluminate them too. I think the best way to do it is using kaimana controller and kaimana j leds but i have no idea how to use it.

I have not bought yet the leds or the controller but i want to be sure exactly what i have to buy, cos the shipping cost are really expensive and i dont want to make more than one purchase in paradisearcadeshop for now :slight_smile:

said this, my actual config is :

USB controller for both player

http://www.jammaboards.com/images/products/Arcade_Controls_to_USB_Board_Connection_Overview_Diagram_631x480_2.jpg

Each player has 6 buttons, and there is a P1 Start and P2 Start also, so i want to control 14 buttons in total, but P1/P2 Start cant be sanwa because the wood is too deep, about 2cms and sanwa buttons are not enough long for this, so i will have to iluminate the one i already have with other leds than kaimana j, maybe pele ring? and i think i will need an adaptor to work with kaimana.

I have no clue how to use kaimana with this, i have seen the Guide from paradise arcade : http://support.paradisearcadeshop.net/doku.php?id=kaimana_led_controller but i dont know how to connect the wires for 2 players, seems that the right side is for input all the controls for P1 and the left side is where you connect to the joystick and buttons but allways for P1, i dont know what to do with wires for P2.

Im sure that kaimana is very easy to use but im very lost right now.

The only thing i know for sure is how to connect the leds, making a chain from first to last connecting secuentially with harness wires.

I have seen that @Zensouken did something like this, with 1 kaimana but he uses 2 controllers, one for each player i think.

Any help is welcome, thanks in advance!