Skip to main content

Questions tagged [functions]

Segmenting code into functions allows a programmer to create modular pieces of code that perform a defined task and then return to the area of code from which the function was "called". The typical case for creating a function is when one needs to perform the same action multiple times in a program.

0 votes
2 answers
101 views

I am using an Arduino r4 Wi-Fi to control unique angle settings for two different servo motors during the execution and operation of a device I am building. I want to have the servos use different ...
user1363363's user avatar
1 vote
0 answers
973 views

I'm encountering persistent errors with the sample code provided for my smart home kit project. Despite conducting extensive research and troubleshooting efforts, I haven't been able to find a ...
Mars's user avatar
  • 39
4 votes
1 answer
171 views

Hey there Stack community. I'm working with the Particle Boron v4.1.0. I'm connecting a Garmin Lidar Lite V4 on I2C. I'm using the LIDARLite_v4LED.h header file found in the library given for this ...
Katie Neeley's user avatar
1 vote
1 answer
603 views

I want to round a decimal number (x), but I need to do it differently depending on how it is. If it has integer significant digits, we round to the nearest integer, and if not, we round to the first ...
Libegria's user avatar
-1 votes
1 answer
705 views

I have noticed that the parseFloat() function returns decimal numbers, but only up to 2 decimal places. Would it be possible for it to return the numbers with more decimal places? In case we need more ...
Libegria's user avatar
0 votes
1 answer
4k views

For a larger sketch, I have separated a chunk of code in a separate .cpp file #include "msg.h" #include <Arduino.h> #include <HTTPClient.h> #include <ArduinoJson.h> void ...
Zaffresky's user avatar
  • 183
0 votes
1 answer
146 views

I'm a newbie to arduino but been programming lots. I have a project where I would like to output 4 bits to adjacent pins and read 4 bits from another (4) adjacent pins. (Imagine a matrix keyboard ...
Dave's user avatar
  • 11
-1 votes
2 answers
1k views

Well, I'm trying to use a HMI display and this HMI storing datas in separeta addreses. Such as integers addr. is between 0x80000 to 0x9ffff and also for string's addr is between 0 to 0x1ffff. At this ...
mehmet's user avatar
  • 297
3 votes
1 answer
118 views

I'm just curious as to why there are no brackets at the end of the ISR when attaching and assigning the interrupt command? attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE); ... ...
Diesel's user avatar
  • 144
0 votes
1 answer
87 views

I want to specify a function with parameters for a function parameter, but it doesn't come together. //////////////////////////////////////////////////////////////////////// // Example funch... void ...
CloverField's user avatar
1 vote
0 answers
432 views

I hope you're doing well. I have some questions regarding the PID functions. Can you please explain to me the following commands? I shall be very thankful to you. PID myPIDX(&InputX, &OutputX,...
John C.'s user avatar
  • 21
1 vote
2 answers
993 views

I am facing a problem where the if condition in the function waterNowrun is able to execute once after the program starts as the variable v is 0 at the start, but upon starting it again the if does ...
Coder9390's user avatar
  • 512
1 vote
1 answer
2k views

I want to include a function in my sketch I moved to a .h file. I did it as follows: My code: #include "header.h" void setup() { fct(); } void loop() { } My header: #include "...
Spyro 999's user avatar
1 vote
1 answer
996 views

Let's say I want to create 10 functions, named Function1, Function2 until 10. Each function is used if a certain variable is equal to its number. Rather than using individual functions, I was ...
AndroidV11's user avatar
0 votes
1 answer
60 views

https://www.arduino.cc/reference/en/ Language Reference Arduino programming language can be divided in three main parts: functions, values (variables and constants), and structure. functions For ...
AndroidV11's user avatar

15 30 50 per page
1
2 3 4 5