arduino digital READ inputs to serial write

Hi to all,

I don't know if this questions is here or in -interfacing with processing- but I will do my best to explain my issue...

I want to calc the speed of a rim bike, now I found a code than works perfect. it reads the magnetic sensor each time were the magnet pass through the sensor (default open) and close the circuit, so the code calc the time in miliseconds and send by serial.write function to processing...

the issue here is than I want to read to different rims at the same time, so I need 2 digital read inputs to send the info by serial.write and then in processing, use the values from rim1 and rim2

right now, I think than the hard problem is in arduino, for it reason I post here, but if someone have a better idea or can say me clues of how to do this, I will be greatfully

the code than i'm using is:

//credits to Adam of project

#define LED 13     //pin for the LED
#define SWITCH 0   //input for REED SWITCH

int val = 0;                     //used to store input value
int previousVal = 0;             //lets not be too repetitious
unsigned long time = 0;          // the last time the output pin was toggled
long debounce = 10;              // the debounce time, increase if the output flickers

void setup() {
 pinMode(LED, OUTPUT);   //tell arduino LED is an output
 pinMode(SWITCH, INPUT);   //SWITCH is input

void loop(){
 val=digitalRead(SWITCH);   //read input value and store it

 //check whether input is HIGH (switch closed)
 if (val==HIGH) {
   digitalWrite(LED, HIGH);   //turn LED on
   if (previousVal != HIGH) Serial.write( byte(1)); //old versions of arduino must use this: Serial.print(1, BYTE)
   previousVal = HIGH;
 } else{
   digitalWrite(LED, LOW);
   if (previousVal != LOW && millis() - time > debounce) Serial.write( byte(0));
   previousVal = LOW;
   time = millis();   

Aren't we answering this elsewhere already? Topic locked. Moderator