Keyestudio ARDUINO maker learning kit Manual page 20

Table of Contents

Advertisement

//////////////////////////////////////////////////////////
int val;//define variable val
int ledpin=13;// define digital interface 13
void setup()
{
Serial.begin(9600);// set the baud rate at 9600 to match the software set up. When connected to
a specific device, (e.g. bluetooth), the baud rate needs to be the same with it.
pinMode(ledpin,OUTPUT);// initialize digital pin 13 as output. When using I/O ports on an
Arduino, this kind of set up is always needed.
}
void loop()
{
val=Serial.read();// read the instruction or character from PC to Arduino, and assign them to
Val.
if(val=='R')// determine if the instruction or character received is "R".
{ // if it's "R",
digitalWrite(ledpin,HIGH);// set the LED on digital pin 13 on.
delay(500);
digitalWrite(ledpin,LOW);// set the LED on digital pin 13 off.
Serial.println("Hello World!");// display"Hello World!"string.
}
}
////////////////////////////////////////////////////////////////
Result
keyestudio
www.keyestudio.cc
delay(500);
18

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ARDUINO maker learning kit and is the answer not in the manual?

Table of Contents