FIRST SEMESTER UG DEGREE EXAMINATION,
NOVEMBER 2024
Course: ELE1MN102 – Arduino Programming
Maximum Marks: 70 Time: 2 Hours
SECTION A – (Each Question 3 Marks)
1. How do you declare and initialize a float variable in Arduino?
A float variable stores decimal numbers.
float temperature = 26.5;
2. Define relational operators in Arduino.
Operators: ==, !=, <, >, <=, >=
Example:
if (x > y) { [Link]("x is greater"); }
3. Explain entry-controlled and exit-controlled loops.
Entry-controlled: Condition before loop (for, while)
Exit-controlled: Condition after loop (do-while)
4. How does the break statement help to come out of a loop?
for(int i=0;i<10;i++){ if(i==5) break; }
5. What is Arduino IDE?
Software to write, compile, and upload code.
Features: Code editor, Verify/Upload buttons, Serial Monitor, Library Manager, Board selection.
6. Describe the input output pins of Arduino board.
pinMode(13, OUTPUT); digitalWrite(13, HIGH);
7. Explain the purpose of Serial Monitor.
Used for debugging and monitoring output.
[Link](9600); [Link]("Hello");
8. Define a button switch.
Allows current only when pressed.
pinMode(2, INPUT); if(digitalRead(2)==HIGH){...}
9. What is an OLED display?
OLED emits its own light, no backlight, higher contrast.
10. Illustrate TXD & RXD pins.
TXD = transmit, RXD = receive.
[Link](9600); [Link]("Data sent");
SECTION B – (Each Question 6 Marks)
11. Arduino language: C/C++, functions setup() & loop(), libraries, easy syntax.
12. Functions: Declare, define, call. Built-ins: setup(), loop(), delay().
13. For loop:
for(int i=0;i<5;i++){ digitalWrite(13,HIGH); delay(500);
digitalWrite(13,LOW); delay(500); }
14. Switch case positive/negative/zero.
int num=-3; switch((num>0)-(num<0)){case
1:[Link]("Positive");break;case
-1:[Link]("Negative");break;case 0:[Link]("Zero");break;}
15. Arduino UNO pins: 0–13 digital, A0–A5 analog, TX/RX(0,1).
16. SPI: 4 wires (MISO, MOSI, SCK, SS), high-speed serial.
17. Blink LED alternate delay:
int led=13; void setup(){pinMode(led,OUTPUT);} void loop(){digitalWrite(l
ed,HIGH);delay(100);digitalWrite(led,LOW);delay(1000);}
18. LCD Commands: 0x01 (clear), 0x02 (home), 0x80 (cursor).
SECTION C – (Each Question 10 Marks)
19. Operators in Arduino: Arithmetic, Relational, Logical, Assignment, Bitwise,
Increment/Decrement.
Example: if((a>b)&&(b!=0)) result=a/b;
20. Arduino boards:
UNO (ATmega328P, 5V, 14 digital), Mega (54 pins, 16 analog), Nano (compact), Leonardo (USB),
Due (ARM, 3.3V).