When my PFS2.0 Hitbox layout is finished and working properly. Honestly, you can very easily and in about 5 minutes adapt the downloaded code to work with a Hitbox. Its actually VERY SIMPLE to do.
Here’s some help since you seem to have some trepidations to try it on your own (you can’t break it… trust me):
In the example.ino file (first file in the tab in arudino ide):
find // read arduino pins and ave results in the mapped LED if button pressed (pin grounded)
Under that there should be a bunch of lines for Joystick cases and another line under it a nother //read arduino pins… entry.
Delete everything between the comments.
Replace with the following:
// read arduino pins and save results in the mapped LED if button is pressed (pin grounded)
if(!digitalRead(PIN_UP))
{
// switch is active
if(iLED[LED_UP] == true)
{
//maintain color while switch is active
iLED[LED_UP] = true;
}
else
{
// select new color when switch is first activated
#ifdef RANDOM_COLOR_UP_ON
setLEDRandomColor(LED_UP);
#else
kaimana.setLED(LED_UP, LED_UP_COLOR_ON);
#endif
iLED[LED_UP] = true;
}
}
else
{
// switch is inactive
#ifdef RANDOM_COLOR_UP_OFF
setLEDRandomColor(LED_UP);
#else
kaimana.setLED(LED_UP, LED_UP_COLOR_OFF);
#endif
iLED[LED_UP] = false;
}
if(!digitalRead(PIN_DOWN))
{
// switch is active
if(iLED[LED_DOWN] == true)
{
//maintain color while switch is active
iLED[LED_DOWN] = true;
}
else
{
// select new color when switch is first activated
#ifdef RANDOM_COLOR_DOWN_ON
setLEDRandomColor(LED_DOWN);
#else
kaimana.setLED(LED_DOWN, LED_DOWN_COLOR_ON);
#endif
iLED[LED_DOWN] = true;
}
}
else
{
// switch is inactive
#ifdef RANDOM_COLOR_DOWN_OFF
setLEDRandomColor(LED_DOWN);
#else
kaimana.setLED(LED_DOWN, LED_DOWN_COLOR_OFF);
#endif
iLED[LED_DOWN] = false;
}
if(!digitalRead(PIN_LEFT))
{
// switch is active
if(iLED[LED_LEFT] == true)
{
//maintain color while switch is active
iLED[LED_LEFT] = true;
}
else
{
// select new color when switch is first activated
#ifdef RANDOM_COLOR_LEFT_ON
setLEDRandomColor(LED_LEFT);
#else
kaimana.setLED(LED_LEFT, LED_LEFT_COLOR_ON);
#endif
iLED[LED_LEFT] = true;
}
}
if(!digitalRead(PIN_RIGHT))
{
// switch is active
if(iLED[LED_RIGHT] == true)
{
//maintain color while switch is active
iLED[LED_RIGHT] = true;
}
else
{
// select new color when switch is first activated
#ifdef RANDOM_COLOR_RIGHT_ON
setLEDRandomColor(LED_RIGHT);
#else
kaimana.setLED(LED_RIGHT, LED_RIGHT_COLOR_ON);
#endif
iLED[LED_RIGHT] = true;
}
}
else
{
// switch is inactive
#ifdef RANDOM_RIGHT_HOME_OFF
setLEDRandomColor(LED_RIGHT);
#else
kaimana.setLED(LED_RIGHT, LED_RIGHT_COLOR_OFF);
#endif
iLED[LED_RIGHT] = false;
}
Next, go over to kaimana_custom.h and replace everything with the following:
// kaimana_custom.h Generated from jasensCustoms.com Kaimana Khameleon Code Generator
// KK Code Generator: http://brightstick.freecade.org
// Code is provided for entertainment purposes and use with the Kaimana Khameleon and Panzer Fight Stick 2.
// Code may be copied, modified, resused with this Copyright notice.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// Based on code originally released by ParadiseArcadeShop.com
// Generator Created: November 4, 2015 jasenhicks // jasenscustoms.com -- Cavalier Mannitude Encouragement
//
// THIS FILE GENERATED ON: Friday 18th of March 2016 07:32:28 PM
#ifndef __kaimana_local_h__
#define __kaimana_local_h__
#define __PROG_TYPES_COMPAT__
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "Arduino.h"
#include "kaimana.h"
//ON BUTTON STATE
#define LED_UP_COLOR_ON 127,0,220
#define LED_DOWN_COLOR_ON 127,0,220
#define LED_LEFT_COLOR_ON 127,0,220
#define LED_RIGHT_COLOR_ON 127,0,220
#define LED_P1_COLOR_ON 127,0,220
#define LED_P2_COLOR_ON 127,0,220
#define LED_P3_COLOR_ON 127,0,220
#define LED_P4_COLOR_ON 127,0,220
#define LED_K1_COLOR_ON 127,0,220
#define LED_K2_COLOR_ON 127,0,220
#define LED_K3_COLOR_ON 127,0,220
#define LED_K4_COLOR_ON 127,0,220
#define LED_SELECT_COLOR_ON 127,0,220
#define LED_HOME_COLOR_ON 127,0,220
#define LED_START_COLOR_ON 127,0,220
//OFF BUTTON STATE
#define LED_UP_COLOR_OFF 127,220,0
#define LED_DOWN_COLOR_OFF 127,220,0
#define LED_LEFT_COLOR_OFF 127,220,0
#define LED_RIGHT_COLOR_OFF 127,220,0
#define LED_P1_COLOR_OFF 127,220,0
#define LED_P2_COLOR_OFF 127,220,0
#define LED_P3_COLOR_OFF 127,220,0
#define LED_P4_COLOR_OFF 127,220,0
#define LED_K1_COLOR_OFF 127,220,0
#define LED_K2_COLOR_OFF 127,220,0
#define LED_K3_COLOR_OFF 127,220,0
#define LED_K4_COLOR_OFF 127,220,0
#define LED_SELECT_COLOR_OFF 127,220,0
#define LED_HOME_COLOR_OFF 127,220,0
#define LED_START_COLOR_OFF 127,220,0
//RANDOM COLORS SET
#define COLOR_RANDOM_1 255,0,0
#define COLOR_RANDOM_2 255,255,0
#define COLOR_RANDOM_3 255,255,255
#define COLOR_RANDOM_4 0,0,255
#define COLOR_RANDOM_5 0,255,255
#define COLOR_RANDOM_6 255,0,255
#define COLOR_RANDOM_7 127,255,0
#define COLOR_RANDOM_8 255,0,127
//BOOT AND IDLE SEQUENCE TIMING
#define BOOT_COLOR_DELAY 250
#define BOOT_COMPLETE_DELAY 500
#define MAIN_LOOP_DELAY 50
#define IDLE_TIMEOUT_SECONDS 10
#define IDLE_ANIMATION_DELAY 8
//LED INDEX
#define LED_UP 0
#define LED_UP_B 1
#define LED_K1 2
#define LED_K1_B 3
#define LED_K2 4
#define LED_K2_B 5
#define LED_K3 6
#define LED_K3_B 7
#define LED_K4 8
#define LED_K4_B 9
#define LED_P4 10
#define LED_P4_B 11
#define LED_P3 12
#define LED_P3_B 13
#define LED_P2 14
#define LED_P2_B 15
#define LED_P1 16
#define LED_P1_B 17
#define LED_RIGHT 18
#define LED_RIGHT_B 19
#define LED_DOWN 20
#define LED_DOWN_B 21
#define LED_LEFT 22
#define LED_LEFT_B 23
#define LED_SELECT 24
#define LED_SELECT_B 25
#define LED_HOME 26
#define LED_HOME_B 27
#define LED_START 28
#define LED_START_B 29
#define LED_COUNT 30
#endif
Change your indexes to match how you wired your LEDs up. If you don’t have START/HOME/SELECT wired up with LEDs, leave them in the code, just keep it at the end with the final 6 numbers. Set your LED COUNT to 24 since you have 12x buttons with a Kaimana J on each that has 2 LEDs. Please note I I don’t know exactly how the Js are setup so if you notice a button is pressed and a light on one button lights as well as the a light on the next button, swap your index numbers for everything. Meaning, if you press UP and UP has one of the LEDs light up and then say K1 has one of the buttons light up, that means you need to make LED_UP 1 and LED_UP_B 0; and so forth.
There is a little bit of ownership required on the end user to get these setup. I think more help from the community would be given if there were some statements in your questions like “Hey, I tried this… XYZ and noticed that the LEDs are doing ABC. So I swapped this around in code and it didn’t help. Any thoughts?” It’s hard to must up the desire to help out if someone isn’t at least willing to try something out first.