Let Arduino say Hello World

By Kumantech | 14 August 2017 | 2 Comments
Firstly, let's make a simple project without any peripheral components but an Arduino board. This project makes communication between arudino and PC. It is a gate to access the arduino world.
Supplies needed:
>> Arduino board*1
>> USB cable*1

Arduino board

USB cable

After installing the driver on the arduino board according to the instruction above, open the software of arduino, write a segment program to show "hello world" as soon as the arduino board receiving the command from you, you certainly can make the board show "hello world" without receiving any command. So easy, arduino board will be complied with you by a program statement: if (), we can also use the built-in number 13 pin LED, to make LED twinkle once, then show hello world  

Here is a piece of code for your reference.
//////////////////////////////////////////////////////////
int val;// define variable val
int ledpin=13;// define digital interface 13
void setup()
{
  Serial.begin(9600);//Set baud rate as 9600, it needs to be same as the software. When access specific equipment (e.g. bule tooth),we need to keep the consistent baud rate with other equipments.
  pinMode(ledpin,OUTPUT);//Set digital 13 as output port, Arduino's I/O ports need to be defined like this.
}
void loop()
{
  val=Serial.read();//Read the Arduino command or character and assign to val
  if(val=='R')// Judge if received command or character is "R"
  {  //if it is "R"
    digitalWrite(ledpin,HIGH);// Light up the digital 13 port LED
    delay(500);
    digitalWrite(ledpin,LOW);// turn off the digital 13 port LED
    delay(500);
    Serial.println("Hello World!");//show hello world
  }
}
////////////////////////////////////////////////////////////////

Diagram:


Click tool-serial port monitor


Input R
LED twinkle once
Receive the information hello world from arduino


Notice: choose right COM port, otherwise you can not receive the data, the below is COM port selection.

 

 
Philipphelo
November 29,2017 17:10
ome people, especially those running on busy daily schedules tend to use the pills to help maintain weight since they can not afford to follow all the diet programs. This is not advised. It is recommended that one seek advice from a professional in this f
JefferyJAR
October 02,2017 08:35
Stress can have an unbelievable impact on health. It can come from a variety of sources and have a diversity of manifestations. The tips that are outlined below will aid in the identification of the factors that cause stress and in the steps that we can t
Leave a Reply
Your email address will not be published.Required fields are marked. *
Name *
Email *
Content
Popular blog
Categories