how to separate events

On my bread board I have a light blinking, and also operating independently I have a digitalRead of a button being pushed. I am getting a digital read of the button being pushed every 1 second But I would like to get that digital readout streaming (Independent of the delay of 1000).

Could someone show me where in my code I need to put the Serial.println so I can get a streaming of data from the button push.

void setup() { pinMode(13,OUTPUT); pinMode(5,INPUT); Serial.begin(9600); pinMode(2,INPUT);

}

void loop() { int sensorValue = digitalRead(2); Serial.println(sensorValue, DEC); digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); }

See this.

http://arduino.cc/en/Tutorial/BlinkWithoutDelay

Thank you Spanman, this is perfect.. :)

http://www.arduino.cc/playground/Code/TimedAction#Example

You could also use that library to create some timed actions/kernels/loops (whatever you call them).