Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Aadarsh UNO
Published

Smart Answering Machine

Kids love to interact with smart devices and here is another smart device that will tell kids if their answer is correct or not!

IntermediateProtip292
Smart Answering Machine

Things used in this project

Story

Read more

Schematics

The Connections for the Answering Machine

Code

The Code for Project

Arduino
#include <Servo.h>

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x27 for a 16 chars and 2 line display

const int Y_pin = A0; // analog pin connected to Y output
const int X_pin = A1;


Servo myservo;

int val;

void setup() {
  myservo.attach(9);
  Serial.begin(9600);

  lcd.init();  // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(1, 0);
  lcd.print("Hello Everyone");
  lcd.setCursor(1, 1);
  lcd.print("   Aadarsh");
}

void loop() {
  val = analogRead(Y_pin);
  val = map(val, 0, 511, 0, 90);
  val = analogRead(X_pin);
  val = map(val, 512, 1023, 91, 180);
  myservo.write(val);
  delay(15);

  if (val >= 0 && val <= 90)
  {
    Serial.println("Correct Answer!!");
    lcd.clear();
    lcd.print("Correct Answer!");
  }
  else if (val >= 100 && val <= 180)
  {
    Serial.println("Wrong Answer...");
    lcd.clear();
    lcd.print("Wrong Answer...");
  }
  else
  {
    Serial.println("Move for your Answer!");
    lcd.clear();
    lcd.print("Move for your");
    lcd.setCursor(1,1);
    lcd.print("Answer");
  }
}

Credits

Aadarsh UNO
2 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.