TP Mikro Modul 2






1. Kondisi [Kembali]
Percobaan 3 (LM35 ke LCD) :
Bila suhu yang terbaca pada LCD menunjukkan suhu >25 derajat celcius maka motor akan beputar ke kiri.

2. Gambar Rangkaian Simulasi [kembali]



3. Flowchart  [kembali]


4. Listing Program  [kembali]
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
float tempC;
int tempPin = A0, hasil;
char a[16];
int Tr1 = 0;
int Tr2 = 1;
int Tr3 = 8;
int Tr4 = 9;
int pwm = 10;
void setup() {
  // put your setup code here, to run once:
  pinMode(Tr1, OUTPUT);
  pinMode(Tr2, OUTPUT);
  pinMode(Tr3, OUTPUT);
  pinMode(Tr4, OUTPUT);
  pinMode(pwm, OUTPUT);
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.print("Temperatur:");
}
void loop() {
  // put your main code here, to run repeatedly:
  lcd.setCursor(0, 1);
  hasil = ((5 * analogRead(tempPin) * 100) / 1024);
  sprintf(a, "suhu=%d", hasil);
  lcd.print(a);
  if(hasil > 25)
  {
    analogWrite(pwm, 128);
    digitalWrite(Tr1, HIGH);
    digitalWrite(Tr2, LOW);
    digitalWrite(Tr3, HIGH);
    digitalWrite(Tr4, LOW);
  }
  else
  {
    digitalWrite(Tr1, LOW);
    digitalWrite(Tr2, LOW);
    digitalWrite(Tr3, LOW);
    digitalWrite(Tr4, LOW);
  }
}

5. Video  [kembali]


6. Link Download  [kembali]
Rangkaian Simulasi
Video Simulasi
Program Arduino

Komentar

Postingan populer dari blog ini

Cover Praktikum Mikroprosesor & Mikrokontroller

Cover Mata Kuliah Mikroprosesor dan Mikrokontroler