Chapter 04 - Serial Communication and Variables

In Chapter 4 we will focus on sending information from our Arduino to our computer while a sketch is running. We will also cover doing math with variables as well as begin learning how to control the flow of programs.

Work through the following:

  1. Introduction to Serial Communication
  2. Make Arduino Calculate
  3. Solve for any Side
Chapter 4 Assignment:

As you know (at least if you paid attention in math class) the hypotenuse must be the longest side of a right triangle. Write a sketch that will take two values for any two sides of a right triangle provided in variable declaration and will solve for the third side no matter which two were initially provided.

Your sketch must also check to see if person typing in the variable screwed up and declared a value for the hypotenuse that is shorter than one of the other sides.

For example, it should be able to check the following and tell us there is a problem and tell us what the problem is.

float a = 5;
float b;
float c = 3;

Standards

A-4.1

I can read data sent from the Arduino to the Computer using Serial Monitor

A-4.2

I can send “Strings” from the Arduino to the computer.

A-4.3

I can explain the difference and use of print and println

A-4.6

I can send variables from the Arduino to the computer

A-4.7

I can use an If function to execute code only under specific conditions. 

A-4.8

I can explain and use the different comparison operators.