What's inside a funtion?

I have recently started programming some basic stuff on Arduino and I would like to know what is inside any function I use.

I'll give an example:
I am using the LCD display, I downloaded the LiquidCrystal_I2C.h library and with Visual Studio I opened the .cpp file .. and could see how it was written.
I would like to do the same thing with the Arduino's delay() function and, for example, with lcd.setCursor function.
Coming from STM32 I could just right-click and "open function" ... how do I do it here?

Welcome to the forum

Which version of the IDE have you got installed ?

If you use IDE 2.0.4 then you can right click on a function and go straight to its definition
image

a function is a block of code that performs some operation. that operation may be as simple as turning on a LED, in which case it returns nothing, or monitor a button where it returns the state of the button.

functions can be passed arguments so that they can be used with different devices or different purposes rather than duplicating code

there can be multiple functions in one file (e.g. setup(), loop())

1 Like

Excellent!
I downloaded the latest version of Arduino, previously I was using 1.6 and did not see 'peek'.

If I press "peek", for example, on lcd.clear() the .h file "LiquidCrystal_I2C.h" is opened, not the file "LiquidCrystal_I2C.c" where the function is initialized .. but it's not a problem because since I know that the function is inside "LiquidCrystal_I2C.h" .. I will look at the .c file

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