Uploaded by Siddarth gaming

RDE558A22 Test ECE282 eceCA1

advertisement
AIM:
Q1) Create a system to control two electrical appliances based on the presence or absence of a
person in a room.
Q2)Prepare sketch to control three LED brightness connected after delay of 1 second on
alternate basis using NodeMCU
CIRCUT:
ANS 1)
CODE:
#include <Servo.h>
int y;
Servo myservo;
void setup() {
// put your setup code here, to run once:
pinMode(2,INPUT);
pinMode(14, OUTPUT);
myservo.attach(26);
Serial.begin(9600);
}
void loop() {
y=digitalRead(2);
if(y==1)
{
digitalWrite(14, HIGH);
myservo.write(180);
}
else
{
digitalWrite(14, LOW);
myservo.write(0);
}
}
ANS 2)
CODE:
int x;
void setup() {
pinMode(12,OUTPUT);
pinMode(14,OUTPUT);
pinMode(27,OUTPUT);
pinMode(26, INPUT);
Serial.begin(9600);
}
void loop() {
x=analogRead(26);
x=x/4;
analogWrite(12,x);
delay(1000);
analogWrite(14,x);
delay(1000);
analogWrite(27,x);
delay(1000);
}
LINKS OF WOKWI:
ANS1)
https://wokwi.com/projects/357257577538905089
ANS2)
https://wokwi.com/projects/357261832143823873
LEARNING OUTCOMES:
ANS 1)
By creating a system to control two electrical appliances based on the presence
or absence of a person in a room, we can learn the following:
1. Understanding of sensor-based systems: we will learn how to design a
system that uses sensors to detect the presence or absence of a person in
a room.
2. Knowledge of programming: we will learn how to write code to control
electrical appliances using a microcontroller or similar device.
3. Understanding of electronics: we will learn how to connect and control
electrical appliances using relays or other electronic components.
4. Problem-solving skills: we will learn how to troubleshoot the system to
ensure that it is working correctly.
5. Time management skills: we will learn how to manage your time effectively
to complete the project within the given timeframe.
6. Communication skills: we will learn how to effectively communicate your
ideas and findings to others, which is essential for presenting your project
to others.
7. Collaboration skills: If working on the project in a team, we will learn how to
collaborate and work together effectively to complete the project.
ANS 2)
By preparing a sketch to control three LED brightness connected after a delay of
1 second on an alternate basis using NodeMCU, you can learn the following:
1. Understanding of microcontrollers and programming: You will learn how to
use the NodeMCU microcontroller and program it to control the brightness
of the LED lights.
2. Knowledge of electronics: You will learn how to connect and control LED
lights using NodeMCU and other electronic components.
3. Understanding of programming concepts: You will learn programming
concepts such as conditional statements, loops, and functions that are
essential for developing the sketch.
4. Problem-solving skills: You will learn how to troubleshoot the system to
ensure that it is working correctly, especially if any errors occur while
writing the code.
5. Time management skills: You will learn how to manage your time
effectively to complete the project within the given timeframe.
6. Communication skills: You will learn how to effectively communicate your
ideas and findings to others, which is essential for presenting your project
to others.
7. Creativity and innovation: You can experiment with different combinations
of LED lights and control patterns to create unique effects, which can help
you to improve your creativity and innovation skills.
8. Attention to detail: You will learn how to pay attention to details while
working on electronic circuits, as a small mistake in the circuit can cause
the whole system to malfunction.
Download