EasyManuals Logo

Arduino uno User Guide

Arduino uno
27 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #25 background imageLoading...
Page #25 background image
25
int i;
void setup()
{
pinMode(2,OUTPUT);
Serial.begin(9600);
Serial.println("Welcome to my program");
delay(1000);
flasher(); // call flasher function
Serial.println("I hope you like flashing");
delay(1000);
flasher(); // call flasher again
Serial.println("Here it is one more time");
delay(1000);
flasher();
}
void loop() {}
void flasher()
{
for(i=0;i<3;i++) {
digitalWrite(2,HIGH);
delay(250);
digitalWrite(2,LOW);
delay(250);
}
}
Several things should be noted here. The function flasher() is defined outside the setup() and
loop() functions. When the main program encounters a flasher(); command, the program
immediately jumps to the function and starts executing the code there. When it reaches the end
of the function, the program returns to execute the command that immediately follows the
flasher(); command. It is this feature that allows you to call the subroutine from several different
places in the code. Parameters can be passed to and returned from functions, but that feature is
for the advanced programmer.
This concludes the section on basic program commands. You can write some awesome programs
using just what was described here. There is much more that the Arduino can do and you are
urged to read through the complete Arduino Language Reference page on-line
9 Coding Style
Style refers to your own particular style for creating code and includes layout, conventions for
using case, headers, and use of comments. All code must follow correct syntax, but there are
many different styles you can use. Here are some suggestions:
Start every program with a comment header that has the program name and perhaps a brief
description of what the program does.
Use indentation to line things up. Function name and braces are in column one, then use
indents in multiples of 2 or 4 to mark code chunks, things inside loops and so on.

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino uno and is the answer not in the manual?

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals