Arduino Project: Voice Home Assistant (Roni) (Code)

by - Friday, September 02, 2022

 I said yesterday i will give codes, thats codes. In the comments. Copy codes:)



You May Also Like

7 comments

  1. #include
    LiquidCrystal_I2C lcd(0x27,16,2);

    int buzzer=2;
    String readString = "";
    #define led 13
    #define led2 12
    #define led3 8
    #define led4 7
    #define led5 4

    void setup() {
    lcd.begin();
    lcd.backlight();
    lcd.setCursor(0,0);
    pinMode(buzzer, OUTPUT);
    delay(500);
    pinMode(buzzer, INPUT);
    pinMode(led, OUTPUT);
    digitalWrite(led, LOW);
    Serial.begin(9600);
    }
    void loop() {

    while (Serial.available()) {
    char c = (char)Serial.read();
    readString += c;
    }

    if (readString.length() > 0) { // komut var ise

    if (readString == "Roni can you help me"){
    digitalWrite(led3, HIGH);
    digitalWrite(buzzer,HIGH);
    delay(300);
    digitalWrite(buzzer,LOW);
    lcd.print("Hello");
    if (readString == "Can you open the door"){
    lcd.clear();
    lcd.print("Of course");
    digitalWrite(led, HIGH);
    delay(1000);
    lcd.clear();
    }

    if (readString == "Can you close the door") {
    lcd.clear();
    lcd.print("Sure");
    digitalWrite(led, LOW);
    delay(1000);
    lcd.clear();
    }
    if (readString == "Can you turn on the light") {
    lcd.clear();
    lcd.print("LİGHT!");
    digitalWrite(led2, HIGH);
    delay(1000);
    lcd.clear();
    }

    if (readString == "Can you turn of the light") {
    lcd.clear();
    lcd.print("DARK!");
    digitalWrite(led2, LOW);
    delay(1000);
    lcd.clear();
    }
    if (readString == "can you open the drawer") {
    lcd.clear();
    lcd.print("Openiiing!!");
    digitalWrite(led4 ,HIGH);
    delay(1000);
    lcd.clear();
    }
    if (readString == "can you close the drawer") {
    lcd.clear();
    lcd.print("Closiiing!!");
    digitalWrite(led4 ,LOW);
    delay(1000);
    lcd.clear();
    }
    if (readString == "can you give the cable") {
    lcd.clear();
    lcd.print("Here you are");
    digitalWrite(led5 ,HIGH);
    delay(1000);

    if (readString == "Thanks you"){
    lcd.clear();
    lcd.print("You're welcome:)");
    digitalWrite(led3, LOW);
    digitalWrite(led5, LOW);
    }
    }
    readString = "";
    }
    }
    delay(100);
    }

    ReplyDelete