Interfacing with the Arduino, week (1-4) All Quiz Answers with Assignments.

Share:

 Interfacing with the Arduino





week 1 Assignment :


https://www.electroschematics.com/turn-on-led-button-arduino/


week 2 Assignment :


https://create.arduino.cc/projecthub/57254/turn-led-on-if-surroundings-are-dark-with-ldr-sensor-da9d68


week 3 Assignment :

#include <EEPROM.h>

int address = 0;
int value;

void setup(void)
{
    Serial.begin(9600);
}

void loop(void)
{
    String s = "";
    s = Serial.readString();

    if(s.startsWith("read")){
        address = s.substring(s.indexOf(' ') + 1).toInt();
        Serial.print("Data Address: ");
        Serial.println(address);
        Serial.println(EEPROM.read(address));
    }
    else if(s.startsWith("write")){
        address = s.substring(6, 7).toInt();
        value = s.substring(8, s.length()).toInt();
        Serial.print("Address: ");
        Serial.print(address);
        Serial.print(" Data Write: ");
        Serial.println(value);
        EEPROM.write(address, value);
    }
}

week 4 Assignment :

























No comments