What you are suggesting should work. You can call a function from within another function with no problems but be sure not to construct an infinite loop where functionA() calls functionB() and vice versa, of course. Your code is already cumbersome and will get worse as you add more letters to it. S… Answer from UKHeliBob on forum.arduino.cc
🌐
Arduino Forum
forum.arduino.cc › projects › programming
custom void functions, how to use them? - Programming - Arduino Forum
January 14, 2020 - Hello experts, I need some clarifications on how to use the custom made void functions. This is a simple CW beacon, for the non "ham radio speaking" folks it's a circuit that is keying a transmitter on/off to send a string in Morse code. So, this is my approach: First I define the basic characters, the dot and the dash (di and dah) and all the different variables that are required to have the correct spacing between characters of the same letter, characters of the same word, two consecutive ...
🌐
The Robotics Back-End
roboticsbackend.com › home › arduino void setup and void loop functions [explained]
Arduino Void Setup and Void Loop Functions [Explained] - The Robotics Back-End
September 28, 2021 - Note: even if you declare a variable without initializing it in Arduino, it will automatically get the value “0” (more info about the Arduino language). So, at this point of the program, the counter variable contains the value “0”. ... This is the beginning of the void setup function.
Discussions

Using "Void"
First a quick thank you to all for helping me devote many happy hours to aggravating my myopia! Presently, I only write sketches with void setup and void loop but i see many sketches with other void functions. The reference page says: The void keyword is used only in function declarations. More on forum.arduino.cc
🌐 forum.arduino.cc
11
0
March 17, 2016
Void arguments optional
I'm a beginner in arduino, and I have a doubt in relation to the "void" function. Is it possible to have several arguments in "void" and hide the last ones in case it is not necessary to use? Example: void dig(int pos, uint32_t color1, uint32_t color2, uint32_t color3 ) { ... } Here I would ... More on forum.arduino.cc
🌐 forum.arduino.cc
8
0
June 11, 2022
Call void function outside setup and loop
Good morning, I have a sketch similar to the following one: int my_func(); // function declaration int a = my_func(); // function call void setup() { // do something } void loop() { // do something } int my_func() // function definition { // do something return 1; } The preceding sketch compiles ... More on forum.arduino.cc
🌐 forum.arduino.cc
9
0
December 31, 2022
c++ - How to call a void function within if statement (Arduino) - Stack Overflow
If it's working well then function call is okay. And there has no issue with "How to call a void function within if statement (Arduino)" More on stackoverflow.com
🌐 stackoverflow.com
🌐
Arduino Forum
forum.arduino.cc › projects › general guidance
How to call a void function in a void function. - General Guidance - Arduino Forum
March 19, 2018 - Kinda like this void loop() { Function3(); } void Function3() { void Function1(); delay(100); void Function2(); } void Function1() { do something } void Function2() { do something else } I know that this doesn't work but I need some...
🌐
Arduino
arduino.cc › reference › en › language › variables › data-types › void
void - Arduino Reference
April 25, 2022 - // actions are performed in the functions "setup" and "loop" // but no information is reported to the larger program void setup() { // ... } void loop() { // ...
🌐
Arduino Forum
forum.arduino.cc › projects › programming
Using "Void" - Programming - Arduino Forum
March 17, 2016 - First a quick thank you to all for helping me devote many happy hours to aggravating my myopia! Presently, I only write sketches with void setup and void loop but i see many sketches with other void functions. The reference page says: The void keyword is used only in function declarations.
🌐
Arduino
docs.arduino.cc › language-reference › en › variables › data-types › void
Arduino
The official Arduino programming language structure reference pages.
🌐
Starting Electronics
startingelectronics.org › software › arduino › learn-to-program-course › 15-functions
Arduino Functions | How To Program and Use a Function
March 4, 2015 - void setup() { Serial.begin(9600); DashedLine(); Serial.println("| Program Menu |"); DashedLine(); } void loop() { } void DashedLine() { Serial.println("----------------"); } In the sketch above, the DashedLine() function is created at the bottom of the file and then called twice at the top ...
Find elsewhere
🌐
YouTube
youtube.com › nova technologies
Functions - 4 | void function |Arduino Programming Tutorials for beginners - 68 - YouTube
Arduino Programming Tutorials for beginners. Functions. Void. Void functions.
Published   August 3, 2021
Views   198
🌐
Nebomusic
nebomusic.net › arduinolessons › Void_and_Return_Functions_with_Arduino.pdf pdf
Void and Return Functions with Arduino Mr. Michaud Marist School
Michaud · Marist School · Return Type Function · • Takes in Parameters (Most of the time) • Returns a Value · • Example Use: Math Calculations · • Setup: int multiply(int a, int b) { int answer = a * b; return answer; } Other Examples (Note the data types) Calling Functions ·
🌐
The DIY Life
the-diy-life.com › home › using arduino functions correctly, make your code more efficient
Using Arduino Functions Correctly, Make Your Code More Efficient - The DIY Life
January 14, 2020 - ... //The DIY Life //By Michael Klements //01/03/2017 void setup() { pinMode(13, OUTPUT); //Assign the on board LED to pin 13 } void loop() { blinkLED(3,1000); } void blinkLED(int noTimes, int time) { for (int i=1; i<= noTimes; i++) { digitalWrite(13, HIGH); delay(time); digitalWrite(13, LOW); delay(time); } }...
🌐
YouTube
youtube.com › paul gavini
Creating simple void function in Arduino using WokWi - YouTube
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features · © 2024 Google LLC
Published   May 7, 2023
Views   202
🌐
Arduino Forum
forum.arduino.cc › projects › programming
Call void function outside setup and loop - Programming - Arduino Forum
December 31, 2022 - Good morning, I have a sketch similar ... one: int my_func(); // function declaration int a = my_func(); // function call void setup() { // do something } void loop() { // do something } int my_func() // function definition { // do something return 1; } The preceding ...
🌐
Stack Overflow
stackoverflow.com › questions › 69548632 › how-to-call-a-void-function-within-if-statement-arduino
c++ - How to call a void function within if statement (Arduino) - Stack Overflow
const int btnpin = 9; int btnstate = 0; unsigned long currentTime; unsigned long previousTime; const long period = 3000; // the setup void setup() { pinMode(LED_BUILTIN, OUTPUT); pinMode(btnpin, INPUT); Serial.begin(9600); } // the loop void ...
🌐
Circuit Basics
circuitbasics.com › using-functions-in-arduino-programming
How to Use Functions in Arduino Programming
November 11, 2024 - LEDs are a good way to demonstrate this topic since they can be replaced by any other device that can be controlled by the 5V signal from an Arduino. So let’s make the functionName() function blink a green LED and a blue LED.
🌐
Tweaking4All
tweaking4all.com › home › arduino programming for beginners – part 6: functions
Tweaking4All.com - Arduino Programming for Beginners - Part 6: Functions
December 2, 2019 - The following code block, between accolades, is something we have seen before as well in for example the “if” function and the different loop kinds (“for”, “while” and “do … while …”). This code block groups the instructions for our function. ... This function, called “SayHello()”, takes no parameters since there is nothing between the () brackets. It also does not return a value, since we used the special datatype “void” – which means “nothing, thin air, nada”.
🌐
TutorialsPoint
tutorialspoint.com › arduino › arduino_functions.htm
Arduino - Functions
The following example demonstrates ... } Void loop () { int result = 0 ; result = Sum_func (5,6) ; // function call } int sum_func (int x, int y) // function declaration { int z = 0; z = x+y ; return z; // return the value } The second ...
🌐
Arduino Getting Started
arduinogetstarted.com › reference › arduino-void
void | Arduino Getting Started
March 13, 2026 - // actions are performed in the functions "setup" and "loop" // but no information is reported to the larger program void setup() { // ... } void loop() { // ... } ... Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you. Additionally, some links direct to products from our own brand, DIYables . ... We are AVAILABLE for HIRE. See how to hire us to build your project ... ArduinoGetStarted.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com, Amazon.it, Amazon.fr, Amazon.co.uk, Amazon.ca, Amazon.de, Amazon.es, Amazon.nl, Amazon.pl and Amazon.se
🌐
Arduino Forum
forum.arduino.cc › projects › programming
How to return a value from a void function and use it inside the void loop? - Programming - Arduino Forum
January 18, 2017 - Goal: I want the variable tweet (which outputs either HIGH or LOW inside the void print() function) to turn on and off the LED_BUILTIN. Restriction: The if statement "producing" the tweet must run outside of the void loop(). Problem: It seems ...
🌐
SheCodes
shecodes.io › athena › 38332-how-to-create-a-function-in-the-arduino-ide
[Arduino] - How to create a function in the Arduino IDE - | SheCodes
Learn how to define and write functions in the Arduino IDE, and how to call them from the main loop or other functions with examples.