title: Arduino digital pin mapping in C#
body: <p>I'm writing a C# application that is going to interact with an Arduino Mega 2560.
  But I'm quite new using Arduino's board.</p>
  
  <p>So my question is it possible to map the pins in the C# application in order to monitor the states of my digital inputs.</p>
  
  <p>Example:</p>
  
  <p>I make the Arduino setup like this</p>
  
  <pre><code>pinMode(22, INPUT)
  (...)
  pinMode(53, INPUT)
  </code></pre>
  
  <p>And then in the C# I can read a specific pin to get its state. Whit something like:</p>
  
  <pre><code>serialPort1.Read("pin44"); //and with that read I can see if its in HIGH or LOW.
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
  {
  int pinNumber = serialPort1.**ReadPinNumber()**; //I would store the number of which pin is generating the data and do something with it.
  }
  </code></pre>
  
  <p>I don't know if I was clear enough, but what I need is to constantly receive data from the arduino and know from which pin is coming from, so I can do something according to my needs.</p>
  
  <p>I already succeded the first part. I can receive the data and do something about it. But when comes to multiple pins is the tricky part.</p>
  
  <p>Thank you in advance.</p>