Direct command

I want to send commands directly to the module useing serial port,(regardless of programming language)
how do I know what should I send (in ASCII or HEX or Binary) throw the serial port to execute something like, digitalWrite(5,HIGH) ?
is there any referance to explain that?
thank you

Have a look in file->examples->communications.
I did it in this way:

 if (Serial.available() > 0) {
    incomingByte =;
    if (incomingByte == 'x') { // insert here what ever you 'd like to, digitalwrite, read etc.
      for (i=0; i<N/2; i++){
        Serial.print(x[i], DEC);
        Serial.print(", ");
        if ((i+1)%10 == 0) Serial.print("\n");
      } // 
      Serial.println(" Vupolneno, moi Gospodin, vhodnue dannue s ACP.");
    // f command - printout data after FFT. Clear view of each bin in the spectr.
    // Plus printing summary accumylator for each band and variable MAXIM.
    if (incomingByte == 'f') {
      for (i=1; i<N/4; i++){
        Serial.print(fx[i], DEC);
        if ((i+1)%10 == 0) Serial.print("\n");
      } // Prosmotr dannuh massiva polychennogo posle FFT