IOT
IOT MATERIAL
experiment no.5
interfacing IR sensor with arduino and buzzer
block dig and discription
Block dig:
code
int irSensor = 12;
int buzzer = 7;
void setup()
{
Serial.begin(9600);
pinMode(irSensor, INPUT);
pinMode(buzzer, OUTPUT);
}
void loop()
{
int value = digitalRead(irSensor);
Serial.println("");
Serial.print("Sensor Value = ");
Serial.print(value);
if(value == 0)
{
digitalWrite(buzzer, HIGH);
}
else
{
digitalWrite(buzzer, LOW);
}
delay(50);
}
Experiment no : 6
interfacing 16*2 lcd with arduino board for display message or informtion
block dig :
Code:
//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Hello, world!");
lcd.setCursor(2,1);
lcd.print("Ywrobot Arduino!");
lcd.setCursor(0,2);
lcd.print("Arduino LCM IIC 2004");
lcd.setCursor(2,3);
lcd.print("Power By Ec-yuan!");
}
void loop()
{
}
Experiment no 7:
dc motor spped control by PWM
ciruit diG :
Code :
//YouTube | Tech at Home
int in1=2;
int in2=3;
int en1=6;
void setup()
{
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(6,OUTPUT);
}
void loop()
{
digitalWrite(in1,HIGH);
digitalWrite(in2, LOW);
analogWrite(en1,255);
delay(100);
}
Experimernt no : 8
vidio link
install raspbrri pi on diffrent oprating system
we need three software
1.raspberii pi imager:
it used to get the os from desktop to the
cardreder and open it again and create one file
name ssh without any extention
2.putty:
puttty is used to create a ip address.
we just have to put the host name of the file.
3.vnc server:
copy the ip address from the putty and pest it to
the vnc server and you can see the new os infront of you.
Expriment no : 9
arduino with ldr
code :
// A0:
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin A1:
int sensorValue = analogRead(A1);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1024.0);
// the lower the voltage, the brighter it is
if ((voltage >= 0) && (voltage <= 0.4)) {
Serial.print ("it is light - ");
} else if ((voltage > 0.4) && (voltage <= 2)) {
Serial.print ("it is bright - ");
} else {
Serial.print ("it is dark - ");
}
// print out the value you read:
Serial.println(voltage);
// D0:
// when sensor pin D0 is connected, the sensor only knows the state light (0.14V) and dark (5.0V).
// The brightness at which the particular state is to be set can be set using the rotary potentiometer.
}
Experiment no : 10
vidio link
you need bluthooth serial controoler in you pc
code :
//YouTube | Tech at Home
int led = 13;
int data;
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop()
{
while(Serial.available() > 0)
{
data = Serial.read();
Serial.println(data);
if(data == 'A')
{
digitalWrite(13, HIGH);
}
if(data == 'B')
{
digitalWrite(13, LOW);
}
}
}
Experiment 10 :LED bblinking
Comments
Post a Comment