Go Down

Topic: Direct command (Read 1 time) previous topic - next topic

babakmanafi

Hello
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

Magician

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

if (Serial.available() > 0) {
    incomingByte = Serial.read();
    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.print("\n");
      Serial.println(" Vupolneno, moi Gospodin, vhodnue dannue s ACP.");
      delay(200);
    }
    // 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);
        Serial.print(",");
        if ((i+1)%10 == 0) Serial.print("\n");
      } // Prosmotr dannuh massiva polychennogo posle FFT

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy