Void loop() error

Hello guys I have a problem in Arduino IDE 2.2.1
If ı use
void loop()
{
}
Error is
In function 'void loop()':
: error: 'digitalwrite' was not declared in this scope
: note: suggested alternative: 'digitalWrite'

If I use

void loop();
{
}

error is
error: expected unqualified-id before '{' token

How Can I fix that problem

Please take a few minutes and read How to get the best out of this forum, especially the part on putting code and compiler error messages in code tags.

Welcome to the forum

In the first case, unless you have a function in the sketch named digitalwrite() you will get that error. digitalWrite() is, however, a built in function that does not need to be explicitly in your sketch. Presumably you want to use digitalWrite() to control the state of a pin

In the second case there should not be a semicolon after loop()

Please post a full sketch illustrating your problem, using code tags when you do

In C/C++, character case is extremely important. The function name is digitalWrite(), not digitalwrite().

This will compile without errors:

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH); // <-- This is a GOOD digitalWrite();
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW); // <-- This is a GOOD digitalWrite();
  delay(1000);
}

This will cause errors and not compile:

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalwrite(LED_BUILTIN, HIGH); // <-- This a BAD digitalwrite();
  delay(1000);
  digitalwrite(LED_BUILTIN, LOW); // <-- This a BAD digitalwrite();
  delay(1000);
}

First, please always enclose the code inside "code" tags. It makes clearer for us to properly read your code,
Second, the first code doesn't have any "digitalwrite" in it, you just have an empty loop() function. what do you think the compiler can do?
Third, even if you add the "digitalwrite" you're talking about, note "digitalwrite" does not exist as a function. This language is case sensitive, so the function call should be "digitalWrite".
Fourth, always post your full sketch: you can't have the loop() without the setup() function, it won't ever compile!
Fifth, the second loop() example shows you not only know Arduino sketches structure and any basic Arduino functions like "digitalWrite", but with a semicolon just after loop() will completely void its content (the semicolon is a command terminator character).

I'm afraid but you need to spend at least a couple of hours reading some Arduino programming basics, then come back with more consistent questions.

Guys thanks for answer

I solved that problem ı forgot digitalWrite thanks everbody

wasn't it suggested by the compiler?
see what is highlighted in red

here's the output i got

C:\stuff\SW\Arduino\_Others\Tst\Tst.ino: In function 'void loop()':
Tst:8:5: error: 'digitalwrite' was not declared in this scope
     digitalwrite (10, 1);
     ^~~~~~~~~~~~
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:8:5: note: suggested alternative: 'digitalWrite'
     digitalwrite (10, 1);
     ^~~~~~~~~~~~
     digitalWrite
exit status 1
'digitalwrite' was not declared in this scope

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