Monday 5 September 2016

ADC with Arduino

ADC with Arduino:

Program for Temp controlled with ADC:


#include<LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);
#define analog_pins A0;
void setup()
{
  lcd.begin(16,2);
}
void loop()
{
  lcd.clear();
  float temp=analogRead(A0);
 int a=(temp*0.488);
 lcd.setCursor(0,1);
 lcd.print(a);

 
  if(a>20&&a<35)
{
  lcd.setCursor(0,0);
  lcd.print("light gets off");
}
else if(a >35)
  {
    lcd.setCursor(0,0);
  lcd.print("motor starts");

  }
  delay(1000);

}

Simulation:


  

0 comments:

Post a Comment

if you have any doubt please let me know