Arduino: Basic Functions

Functions are a core component of any programming language and are incredibly useful.  They save you time, make your programming more efficient, speed up error correction an can be recycled in the same or other programs.

You will create the circuit and program in Tinkercad and turn in the share link on Canvas.   Click here to learn how to create a share link in Tinkercad. 

Before you go any further, please watch my video tutorial on Arduino Functions.

Click here for my Arduino Functions Handout

Video description of the assignment.

Click here for a sample program with functions.

Click here for sample servo code.

Click here for sample buzzer code

Your assignment is to write an Arduino program in Tinkercad that includes functions.

Here are the details – you will write an original program of your own.  Do not use someone else’s program and/or anything AI generated:

  1. Put your name at the top of the program as a comment.
  2. Use variables in your code.
  3. Include Serial monitor in your program.
  4. Use at least two of these three output options in your code: multiple LEDs, multiple buzzer sounds and servos.
  5. Create at least two functions for each output.  Example: two different buzzer sequences and two different LED sequences.
  6. Each function should have Serial monitor to tell when that function is running.
  7. Call each of your functions in your program at least two times.
  8. Add at least four comments that describe your understanding of what that line of code does.

You will create the circuit and program in Tinkercad and turn in the share link on Canvas.   Click here to learn how to create a share link in Tinkercad.