Microprocessor course Final Exam EET326 Micr opr ocessor s Name Pr ovide complet
ID: 3348646 • Letter: M
Question
Microprocessor course
Final Exam EET326 Micr opr ocessor s Name Pr ovide complete explanation for your response Date Describe lhe ?llowing declarations in your own words: a) char buffer 12 1 . (10ps) b) const int inputPin = 5; 2. Placc comments or the code below. (1Opls) const int ledPin 13; const int inputPin 11; void setup) pinMode(ledPin, OUTPUT); I/ pinMode(inputPin, INPUT); II digitalWrite(inputPin, HIGH); II 3. o hc codc bclow, 'number will havc a valuc o alter xcculion (5pls) int number 12; number += 2;Explanation / Answer
1)
a) char buffer[12] means you need to store some input somewhere before processing it , buffer is that place and [12] specifies that 12 characters will be holded by array
b) const int InputPin=5 ; means a constant value,5 is choosen as the input pin.
2)
cost int ledPin=13; // led pin is selected as 13 , which is choosen as constant
const int inputPin=11 // input pin is choosen as 11 which is constant and cannot be changed, user can input some data using this pin
void setup(){
pinMode(ledPin,OUTPUT); // declare ledpin as an output
PinMode(inputPin,INPUT);// declare inputpin as input
digitalWrite(inputPin,HIGH);// turn inputpin on
}
3) int number = 12;
number+=2;
Ans = number is now 12+2=14
4)
a) input= blank,return=blank
b) input=note, return = duration
c) input = pin, return=percent