Sunday, February 24, 2013

Arduino Due code example: Serial communication - Tx

Simple example run on Arduino Due to send data via Serial, with baud rate of 115200.

#define MSG_SIZE 17

char hellomsg[MSG_SIZE] = {'H', 'e', 'l', 'l', 'o', ' ', 
  'A', 'r', 'd', 'u', 'i', 'n', 'o', '-', 'e', 'r', '!'};

void setup() {
  //Setup Serial Port with baud rate of 115200
  Serial.begin(115200);

}

void loop() {
  for(int i = 0; i < MSG_SIZE; i++){
    Serial.print(hellomsg[i]);
    delay[500];
  }
  
  Serial.println();
  delay(1000);
}

No comments:

Post a Comment