void... where?!?

hi,
this is a super stupid newb question but i just can't figure it out by myself and search does not help either. i'm using this (by the way super awesome) library GitHub - dxinteractive/ResponsiveAnalogRead: Arduino library for eliminating noise in analogRead inputs without decreasing responsiveness. and on its github page are settings listed i want to use, eg:

void setActivityThreshold(float newThreshold) // the amount of movement...

but what does this "void" in the beginning mean and where do i put this line? does it go in "void setup"? or "void loop"? or do i have to replace it with something different?!? i tried out anything i could think of but just get error messages.

thanks for any help!
karl

All names you listed are called "functions". A function can return one value to the code that called it. If the function does not return a value the word "void" tells the compiler not to expect a return value.

Look up the usage of "function" and there may be a better description.

Paul

The keyword "void" means "empty" and is used to fill in various fields.

As previously mentioned, it can fill in for the return value, when a function returns no value. You can also define a function that requires no argument, in which case you specify the argument as "void".

functions can also return variables, that means that when you call the function during the execution it will have to get a value through the return function.

for example:

you can create a function that will read an analog pin, and check the las value that was read, if they are not the same, it means that it have changed, so you can return 1, if the value is the same return 0.

Code Example:

bool AnalogChanged(uint8_t pin)
{
    uint8_t Reading = analogRead(pin);

    if(Reading != LastReading)
    {
        LastReading = Reading;
        return 1;
    }
    return 0;
}

so you can call this function in the loop this way

if(AnalogChanged(A0)) { Serial.println(LastReading); }

For historical reasons, C functions DEFAULT to returning an "int" value.
To actually proclaim that your function does not have any return value, "void" was added.

void setActivityThreshold(float newThreshold) // the amount of movement... is a sub routine function.
A sub routine is called from either the main loop or another sub routine or maybe a library function if you wrote one yourself. You would put it outside of the Void Loop section.You will need the rest of the program if you want that to work though.

hey everybody,
thank all of you for for all the input! i guess i still do not get my head around some basic concepts really. however, i did manage to figure out my problem. i do not know wether this is the correct way of doing things but since noone mentioned this above and it sure does solve my case:

the settings seem to refer to the instance of the library, in my case i named that "analog":

// ResponsiveAnalogRead library
#include <ResponsiveAnalogRead.h>
const int ANALOG_PIN = A5; // define the pin you want to use
ResponsiveAnalogRead analog(ANALOG_PIN, true, 0.01);

so in then i can just set the threshhold-setting (in void setup) with:
void setup() {
Serial.begin(57600);
analog.setActivityThreshold(7.0);

all the best
k