Reading the state of a pin in C#

I'm trying to read the state of a pin on the arduino and get the C# app to do a certain task, i know how to write to the arduino from the C# app, but i cant figure out how to get it to read the value of the pin ( high=1/low=0 ) from the serial and then make the app do a task ( ex. open a new form in the app or change the color of a box).
I just need the program to read the serial without showing the actual serial data, just do a task when it receives a 1 in the serial data, and do its task.

I have done a few c# programs before but only to send data over serial when a button is pressed or a event have been triggered.

Does anyone have an idea to do this, or could give me a few pointers how to do this? any help is appreciated

Seems pretty simple:

if (Serial.available()>0){ // new byte came in?
incomingByte =; // read it
if ( (B00000001 & incomingByte)) == 1){ // is bit 0 a 1?
// do some action
else {
// do some other action (or leave this out if no other action)

google arduino c# serial => 365.000 hits 0.18 seconds :slight_smile:

check - - trick is OnReceived()

Thank you both now i have something to work with.