[Q] X-Sim and Arduino problem

So I'm not sure if it's a problem with X-Sim or the Arduino code, chances are it's the code that is causing issues.

Anyways, so about three years back, herctrap made a USB instrument cluster for use with LFS, and I couldn't find any other "tutorials" or codes in that were whole enough to make something like that myself.

I got my hands onto X-Sim and the cluster, broke out the arduino and got going, I've altered the code to fit my cluster, and a few mods here and there.
However, it seems like it's either reading, only the first letter being sent from X-Sim, since I can't get both the speedo and the rev counter working at the same time, if I put "R~a01~" first in the Axis definition box in X-Sim, Arduino reads that and makes the RPM Counter work, switch that with "S~a02~" and it makes the speedo work.

Put both in, "R~a01~S~a02~" in that order, only RPM counter works, if I switch it, making it say "S~a02~R~a01~" only the speedo works.

I know, it's confusing but I did my best to explain it ;_;

Help please? I'll post the code either here or on pastebin including some screencaps from the X-Sim software if that's needed.

Links?

Here's the code: Arduino Cluster - Pastebin.com

Screens


Right, I feel really stupid now.

Though I did figure the problem, it was the Arduino code. Since I was using the "tone" command, however, I tried analogWrite as well, though first of all, the rpm counter just goes all the way up and the Speedo doesnt really respond in particular, except when you're doing about 38-39KM/H. It jumps about abit then.