ghadeer ecet bonus
ECET 264
C Programing Language Application
BONUS TAP
Introduction to Arduino
|
Student Name |
Student ID |
|
|
|
|
S |
Topic |
Max Points |
Earned Points |
Feedback |
|
1 |
Question 1 |
20 |
|
|
|
2 |
Question 2 |
20 |
|
|
|
3 |
Question 3 |
20 |
|
|
|
4 |
Question 4 |
20 |
|
|
|
5 |
Question 5 |
20 |
|
|
|
6 |
Bonus |
10 |
|
|
|
|
Total |
110 |
|
|
Question 1: (20 points/ 2 points each) Watch the provided link: https://www.youtube.com/watch?v=oiivezm6bx8&list=PLlzmd439B074hYEBYZ58mRbQ9QtpxPQ-w
List the different parts numbered in the figure. Write in your own words (based on your understanding) what is the job of each part.
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
Question 2: (20 points)
Watch the provided link:
https://www.youtube.com/watch?v=8bufqdXwCpY&list=PLlzmd439B074hYEBYZ58mRbQ9QtpxPQ-w&index=2
Given the below arduino code for a blinking LED:
void setup() {
pinMode(12,OUTPUT);
}
void loop() {
digitalWrite(12,HIGH);
delay(1000);
digitalWrite(12,LOW);
delay(1000);
}
1- Modify the code so that the LED is connected to pin 4 and the delay is half second between each blinking. (15 points)
2- What happened to the led speed blinking when the delay was changed?
(5 points)
Question 3: (20 points) Watch the provided link:
https://www.youtube.com/watch?v=SKQzljqd3cQ&list=PLlzmd439B074hYEBYZ58mRbQ9QtpxPQ-w&index=4
Write an Arduino code to control two LEDs using a push button, given the bellow setup:
1- LED 1 is connected to pin 6
2- LED 2 is connected to pin 7
3- Button is connected to 8
Whenever the push button is pressed, LED 2 will be OFF and LED 1 will turn ON. If not pressed LED 2 will be ON and LED 1 will turn OFF.
Question 4: (20 points) Watch the provided link:
https://www.youtube.com/watch?v=9G0UFQAFWUQ&list=PLlzmd439B074hYEBYZ58mRbQ9QtpxPQ-w&index=5
Write an Arduino code to control two LEDs using two push buttons, given the bellow setup:
1- LED 1 is connected to pin 6
2- LED 2 is connected to pin 7
3- Button 1 is connected to pin 8
4- Button 2 is connected to pin 9
If both push buttons are pressed, LED 1 is ON and LED 2 is OFF. If one of the push buttons is pressed LED 2 is ON and LED 1 is OFF.
hint: you may use the if..else if statement (note: you may use other approaches)
Question 5: (20 points) Watch the provided link:
https://www.youtube.com/watch?v=u1riERgDYU0&list=PLlzmd439B074hYEBYZ58mRbQ9QtpxPQ-w&index=9
Write a code to blink an LED connected to pin 5 four times with a delay of 100 ms each time using a for loop. There will a pause of 4 seconds after each round.
Question 6: Bonus (10 points/ 2.5 points each) Watch the provided link:
https://www.youtube.com/watch?v=JwpBn1mPGMc&list=PLlzmd439B074hYEBYZ58mRbQ9QtpxPQ-w&index=7
1- List the pins on Arduino that can do analog write.
2- In a PWM, given that the duty cycle is 75% what is the voltage output?
3- In a PWM, what should be the duty cycle to get a voltage output of 4 V?
4- Given the bellow Arduino command:
analogWrite( 5, 150);
a- What is the duty cycle?
b- What is the voltage output?
1 of 3
2 of 3