Home > Arduino > Send serial data (strings) from Arduino

Send serial data (strings) from Arduino

So I have some spare time, so I looked at the Serial Communication using the Arduino device. I was able to successfully send messages from the Arduino board to the Arduino Serial Monitor on my laptop. I was able to send simple  hard coded values as well as dynamically generated string messages.

#include <stdio.h>

char serialstring[35];

void setup() {  

void loop() {  
 //print string directly  
 Serial.println("This is a hardcoded string");
 //setup string in a variable  
    strcpy(serialstring,"This is a string inside a variable");
    Serial.println(serialstring);//print string variable  

    for(int j=0; j<3; j++) {   
 //print the value of the variable J 
        sprintf(serialstring,"Dynamic Message. Variable J = %d",j);    

Once uploaded the results are as expected

And this concludes the Serial Communication Test for now. I think I will look at sending strings to the Arduino next time.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: