Sharp sensor

244 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
244
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Sharp sensor

  1. 1. R-tist
  2. 2. R-tist12/6/2012 i-SKY TECHNOLOGIES 2
  3. 3. SHARP SENSOR  IN AVR ADC IS IS INBUILT SO THERE IS NO NEED OF EXTERNAL CIRCUIT.  THIS SHARP SENSOR HAS RANGE OF ONLY 10 TO 80 CM.  WHEN IT IS OUT OF RANGE THAN IT GIVE RANDOM VALUE OF DISTANCE.  DUE TO THIS IN PROGRAM WE USE 0 VALUE WHEN IT IS OUT OF RANGE.R-tist 12/6/2012 i-SKY TECHNOLOGIES 3
  4. 4. FORMULA FOR DISTANCECALCULATIONsensorValue = (6787 / (sensorValue - 3)) - 4;12/6/2012 R-tist i-SKY TECHNOLOGIES 4
  5. 5. PROGRAM TO SHOW DIS. ONSERIAL PORT  #include <LiquidCrystal.h>  void loop() {  const int analogInPin = 0;  sensorValue =  float sensorValue = 0; analogRead(analogInPin);  LiquidCrystal lcd(4, 7, 8, 9,  lcd.setCursor(0, 0); 12, 13);  if(sensorValue<80)  void setup() {  sensorValue=0;  lcd.begin(16, 2);  else  }  sensorValue = (6787 / (sensorValue - 3)) - 4;  lcd.print(sensorValue);  lcd.print(" ");  delay(100);  }12/6/2012 R-tist i-SKY TECHNOLOGIES 5
  6. 6. Q-: WRITE A PROGRAM TO DEMONSTRATE WHEN DISTANCE OF OBJECT IS LESS THAN 40 CM THAN RED LED OF RGB IS GLOW WHEN IT IS 40-50 GREEN LED IS GLOW AND WHEN IT IS GREATER THAN 50 BLUE LED GLOW12/6/2012 R-tist i-SKY TECHNOLOGIES 6

×