Here we’ll be using C++ programming language to program the Arduino module.
//Programming Arduino in-built LEd
/*13 pin is the LED present in Arduino Board.
* You can define any other digital pin as well i.e 12,11,9,8 etc
*
*
*/
// put your one time setup code here, to run once
void setup() {
Serial.begin(9600);
pinMode(13,OUTPUT);
}
// put your main code here, to run repeatedly
void loop() {
Serial.println("Digital pin going high");
digitalWrite(13,HIGH);
delay(1000);
Serial.println("Digital pin going low");
digitalWrite(13,LOW);
delay(1000);
}
setup(): Setup function execute only once, which should contain code that should be executed only once.
Loop(): Loop function will be executed iteratively as long as the arudino runs.
Serial.begin(Baud rate): Here it specify the baud rate (the speed at which the information as bits transferred from arduino to connected device , here computer).
Baud rate can be specified as 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200.
Serial.println: It prints the message on Serial Monitor.
digitalWrite(pin,HIGH/LOW): It takes two parameter, first parameter take the digital pin number, second parameter bring the pin to High/Low.
delay(millisec):It pause the arduino execution for specified milliseconds.