I would recommend extending your use of the serial connection to transmit all of your data or just what you are having issues with. See how I manage my serial data as part of my debug at the end of the program code. Second, I would comment out your code, /* code */, to remove the sections that work and to isolate where your issue is. I cant help you directly as I don't know where your wires are going or doing for pin locations. Comment after your pinMode to highlight what that output is supposed to do and I may come up with something. Lastly, you dont need analogWrite as you are using them as digitalWrite, analogWrite(pin, 0) = digitalWrite(pin, LOW), analogWrite(pin, 255) = digitalWrite(pin, HIGH). If you use the map function to change your output with your input you will need to...see more »I would recommend extending your use of the serial connection to transmit all of your data or just what you are having issues with. See how I manage my serial data as part of my debug at the end of the program code. Second, I would comment out your code, /* code */, to remove the sections that work and to isolate where your issue is. I cant help you directly as I don't know where your wires are going or doing for pin locations. Comment after your pinMode to highlight what that output is supposed to do and I may come up with something. Lastly, you dont need analogWrite as you are using them as digitalWrite, analogWrite(pin, 0) = digitalWrite(pin, LOW), analogWrite(pin, 255) = digitalWrite(pin, HIGH). If you use the map function to change your output with your input you will need to use analogWrite but not in your current configuration, maybe will be the next feature to add.