Professional Documents
Culture Documents
Date: Group: Duration:: 5 Class Hours
Date: Group: Duration:: 5 Class Hours
Date: Group: Duration:: 5 Class Hours
REPORT
Date:………………… Group:……………… Duration: 5 class
hours
Full Name Student ID
#include <Servo.h>
Servo myservo;
int led = 6;
int pir = 2;
void setup() {
pinMode(led, OUTPUT);
pinMode(pir, INPUT);
myservo.attach(9);
Serial.begin(9600);
}
void loop() {
int val = digitalRead(pir);
Serial.println(val);
if (val == HIGH) {
digitalWrite(led,HIGH);
myservo.write(70);
}
else {
digitalWrite(led,LOW);
myservo.write(10);
}
delay(10);
}
Click the button Start Simulation and describe what happens.
Code:
#include <LiquidCrystal.h>
volatile int count = 0;
int interruptPin = 2;
float speedRPM = 0;
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void encoderPulse()
{
count++;
}
void setup() {
lcd.begin(16, 2);
lcd.print("DC Motor Speed:");
lcd.setCursor(13, 1);
lcd.print("RPM");
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), encoderPulse, RISING);
}
void loop() {
lcd.setCursor(0, 1);
count = 0;
delay(200);
Screenshot:
Screenshot:
Screenshots: