Robots Atlas>ROBOTS ATLAS

Arduino for Beginners · Sketch Programming Fundamentals

Functions: definition and call

Sketch Programming Fundamentals

Introduction

A function is a named block of code you define once and call many times. This lesson dissects function anatomy (return type, name, parameter list, body, the return statement), the difference between a definition and a call, passing arguments by value and by reference (&), function prototypes and Arduino IDE auto-prototyping, the scope of local variables, and the basics of overloading and default arguments in C++. All of it so you can write DRY code: readable, reusable, and easy to maintain.