Ardoino UNO R3 with 3 Leds and 3 Pushbuttoms with different tasks. Need scheme and code

I need to make a scheme on https://www.tinkercad.com/ and code that 3 different pushbuttoms interacted with their Led. While button 1 is pressed, LED1 is on. Pressing button 2 once turns LED2 on, pressing it again turns it off. While button 3 is pressed, LED3 flashes at 1 Hz. I also have this code but idk if it right.
`const int buttonPin1 = 2;
const int buttonPin2 = 3;
const int buttonPin3 = 4;
const int ledPin1 = 5;
const int ledPin2 = 6;
const int ledPin3 = 7;

bool led2State = false;
bool led3State = false;
bool led3Blink = false;
unsigned long previousMillis = 0;
const long interval = 500;

void setup() {
pinMode(buttonPin1, INPUT_PULLUP);
pinMode(buttonPin2, INPUT_PULLUP);
pinMode(buttonPin3, INPUT_PULLUP);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
}

void loop() {
if (digitalRead(buttonPin1) == LOW) {
digitalWrite(ledPin1, HIGH);
} else {
digitalWrite(ledPin1, LOW);
}

if (digitalRead(buttonPin2) == LOW) {
if (!led2State) {
digitalWrite(ledPin2, HIGH);
led2State = true;
} else {
digitalWrite(ledPin2, LOW);
led2State = false;
}
delay(300);
}

if (digitalRead(buttonPin3) == LOW) {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (led3Blink) {
digitalWrite(ledPin3, LOW);
led3Blink = false;
} else {
digitalWrite(ledPin3, HIGH);
led3Blink = true;
}
}
} else {
digitalWrite(ledPin3, LOW);
led3Blink = false;
}
}`

Is this a school project?

Please insert your code using the code tags. You can go back and fix your original post.
Read the forum guidelines to see how to properly insert the code and some other good information on making a good post.

Do you expect that somebody will do it for you?

I moved your topic to an appropriate forum category @ninprut.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Its university project

Yeah i expect

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.