Error when uploading code to arduino pro mini

Hello!
When uploading code to arduino pro mini, it gives an error, how to fix it?
Help fix it please!
Code:

int Sinput = A1; {

pinMode(Sinput, INPUT); pinMode(Buz, OUTPUT); void loop() {

if(digitalRead(Sinput)==LOW)
{
delay (2000);

digitalWrite(Buz, HIGH);
}
else
{

if(digitalRead(Sinput)== HIGH)
{

digitalWrite(Buz, LOW);
}

}
}


Get rid of the HTML from your sketch.

Post code (all of it), not pictures of code.

This is NOT an installation or troubleshooting issue - please recategorise.

It gives many errors.
You have no definition of Buz, you have no setup function, you have code that is not in any function.

Best guess

const byte Sinput = A1; 
const byte Buz = A2;

void setup ()
{

pinMode(Sinput, INPUT); 
pinMode(Buz, OUTPUT); 
}

void loop()
{
  if(digitalRead(Sinput)==LOW){
    delay (2000);

    digitalWrite(Buz, HIGH);
  }
  else
  {
    digitalWrite(Buz, LOW);
  }
}

I want to make this device like on this site. Website link: https://www.instructables.com/Anti-Sleep-Glasses/

Can you help with the code?

I think I already have

Can you help if the circuit is assembled correctly?

What are all those things in your picture?
(If you'd posted a schematic, I wouldn't have had to ask)

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