0% found this document useful (0 votes)
86 views3 pages

Without LCD Codes

Sample codes

Uploaded by

deshmukhanisha13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views3 pages

Without LCD Codes

Sample codes

Uploaded by

deshmukhanisha13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Temp code:

#define temp A0
Void setup()
{
Serial.begin(9600);
pinMode(temp,Input);
}
Void loop()
{
Float temperature =0;
temperature=(analogRead(temp)*0.48828)-49.95;
Serial.println(temperature);
}

Ultrasonic sensor code:


Const int trig =9;
Const int echo=11;
Long duration;
Int distcm;
Int distinch;
Void setup()
{
Serial.begin(9600);
pinMode(trig,output);
pinMode(echo,input);
}
Void loop()
{
digitalWrite(trig,low);
delayMicroseconds(2);
digitalWrite(trig,high);
delayMicroseconds(10);
digitalWrite(trig,low);
duration=pulseIn(echo,high);
distcm =duration*0.034/2;
distinch =duration*0.0133/2;
Serial.println(distcm);
Serial.println(distinch);
}

Servo motor code:


#include<servo.h>
Servo myservo;
#define sensor A0;
Int values;
Double angle;
Void setup()
{
Serial.begin(9600);
my serve.attach(9);
}
Void loop()
{
Values=analogRead(sensor);
angle=map(values ,0,1023,0,180);
myservo.write(angle);
Serial.println(angle);
}

Humidity code:
# include<DHT11.h>
#define DHTPIN 4;
dht11 DHT11;
Void setup()
{
Serial.begin(9600);
}
Void loop()
{
Int chr=dht11.Read(DHTPIN);
Serial.println(chr);
}

You might also like