So first: I am not a programmer, I'm just passing along what my programmer is telling me. If you have any questions, I'll check with them and see what they have to say about it. I will try and have a empty Unity project up tomorrow with this already in place, but this code will help for anyone that is not using Unity.
This is the code on the Arduino that's sending out the serial data.
byte buttonstates[9];
void setup() {
buttonstates[8] = 1;
for(int i = 0; i< 54; i+=1){
pinMode(i,INPUT_PULLUP);
Serial.begin(9600);
}
}
void loop() {
for(int i = 0; i< 8; i+=1){
buttonstates[i] = 0;
}
for(int i = 0; i< 54; i+=1){
if(digitalRead(i) != HIGH){
buttonstates[(i) / 7] |= 1 << ((i) % 7 + 1);
//Serial.println(i);
}
}
Serial.write(buttonstates, 9);
delay(20);
}
Please share your code/projects if you've found a way to make it work with non-Unity engines!