🔍
What is void in Arduino?
0 like 0 dislike

1 Answer

✔️
Best answer
In Arduino, `void` is a special keyword used in the function definition to specify that the function doesn't return any value.

When you define a function, you usually specify what type of value it will return. For example, a function that returns an integer will have `int` as its return type. But when a function doesn't need to return anything, we use `void`.

For example:

```cpp
void setup() {
  // This function doesn't return anything, it just sets up the initial configurations.
  pinMode(13, OUTPUT);
}

void loop() {
  // This function doesn't return anything either, it repeats the task.
  digitalWrite(13, HIGH); // Turn on the LED
  delay(1000); // Wait for 1 second
  digitalWrite(13, LOW); // Turn off the LED
  delay(1000); // Wait for 1 second
}
```

In the above example:
- `setup()` and `loop()` both use `void` because they do not return any value; they just perform actions like setting up pins and controlling the LED.
- `void` helps tell the Arduino that this function does not need to give any value back after running.
0 like 0 dislike

Related questions

0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
2 views 0 answers
× Full Screen Image

What is Arduino used in IoT?
Answer : Arduino is widely used in the Internet of Things (IoT) because it provides a simple and accessible way to connect physical devices to the internet. It's a versatile microcontroller platform that allows ... it, and communicate with other devices or the cloud, making it easier to create smart systems....

View solution
0 like 0 dislike
2 views 1 answer
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
2 views 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
2 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
0 views 0 answers
× Full Screen Image
0 like 0 dislike
1 view 0 answers
× Full Screen Image
Welcome to Electrical Engineering App, where you get electrical engineering materials in one place.

Subjects

29.4k questions

1.3k answers

7.4k users