Poll
Question: how can we send direct command to the ARDUINO?
1 - 1 (33.3%)
2 - 2 (66.7%)
Total Voters: 3

Pages: [1]   Go Down
Author Topic: Direct command  (Read 1179 times)
0 Members and 1 Guest are viewing this topic.
USA
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2602
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have a look in file->examples->communications.
I did it in this way:
Code:
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
 
Logged

Pages: [1]   Go Up
Jump to: