San Sebastian College
San Sebastian College
Cavite City
Experiment No. 1
“INTRODUCTION TO ARDUINO “
Remarks Grade
On the first part, we simply program the LED’s switching time, it can also be
observed that the switching time of the LED on the breadboard and the LED on the
Arduino functions the same.
void setup() {
pinMode(kPinLed, OUTPUT);
void loop() {
digitalWrite(kPinLed, HIGH);
delay(500);
digitalWrite(kPinLed, LOW);
delay(500);
}
On the second part, we programmed the Led’s constant switching functions,
which is programmed on the Void loop.
void setup() {
pinMode(kPinLed, OUTPUT);
int delayTime=1000;
void loop() {
digitalWrite(kPinLed, HIGH);
delay(delayTime);
digitalWrite(kPinLed, LOW);
delay(delayTime);
}
On the third part, we programmed the Led’s switching delay time with a value of
1000mS , also we set it to progressively fast its switching which is encoded ; delay
time=delay time -100, thus increasing the delay time each loop. The programmed Led’s
switching will eventually reach 0 delay time, which will steadily have a constant
switching value, that’s why we programmed an If statement, which will reset the delay
time back to 1000ms whenever it reaches a delay time of 0s.
void setup() {
pinMode(kPinLed, OUTPUT);
int delayTime=1000;
void loop() {
delayTime =1000;
digitalWrite(kPinLed, HIGH);
delay(delayTime);
digitalWrite(kPinLed, LOW);
delay(delayTime);
}
The fourth activity is to provide a program whenever the last program didn’t
function, we added an else statement, which will rule over the above program, the else
statement acts as a backup program.
void setup() {
pinMode(kPinLed, OUTPUT);
int delayTime=1000;
void loop() {
delayTime =1000;
else{
digitalWrite(kPinLed, HIGH);
delay(delayTime);
digitalWrite(kPinLed, LOW);
delay(delayTime);
}
Lastly, we simultaneously program two “while” statements, those to functions
acts alternately, in above program, whenever a the delay time is above 0s, the delay
time decreased -100ms, until it reaches 0, end when it reaches 0s , a delay time of
1000ms will be added, and so it will cycle back to the 1000ms delay time.
void setup() {
pinMode(kPinLed, OUTPUT);
int delayTime=1000;
void loop() {
digitalWrite(kPinLed, HIGH);
delay(delayTime);
digitalWrite(kPinLed, LOW);
delay(delayTime);
digitalWrite(kPinLed, HIGH);
delay(delayTime);
digitalWrite(kPinLed, LOW);
delay(delayTime);
}
CONCLUSION
On this activity, we have learned the basic of programming of the Arduino board,
which is overly simple, the program codes used is easy to memorize. As a brief
summary of the activity, the pinMode command sets the LED pin to be an output. The
first digitalWrite command says to set pin 13 of the Arduino to HIGH, or +5 volts. This
sends current from the pin, through the resistor, through the LED (which lights it) and to
ground. The delay(1000) command waits for 1000 msec. The second digitalWrite
command sets pin 13 to LOW or 0 V stopping the current thereby turning the LED off.
Code within the brackets defining the loop() function is repeated forever, which is why
the LED blinks. We have learned the capabilities of the Arduino to do multiple tasks
given a simple switching function of a Led.
CIRCUIT DIAGRAM