changed 2 years ago
Linked with GitHub

Making things do things

Coding languages

Flow charts

A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task.

Flowcharts are used in designing and documenting simple processes or programs. Like other types of diagrams, they help visualize what is going on and thereby help understand a process, and perhaps also find less-obvious features within the process, like flaws and bottlenecks. There are different types of flowcharts: each type has its own set of boxes and notations. The two most common types of boxes in a flowchart are:

  • a processing step, usually called activity, and denoted as a rectangular box.
  • a decision, usually denoted as a diamond.

img

Simple example of an algorithm that controls heating based on temperature and human presence:

st=>start: Start
in1=>inputoutput: INPUT Read Temp
iftemp=>condition: temp < 20 ?
in2=>inputoutput: INPUT detect people
ifpeople=>condition: people > 1 ?
ifon=>condition: heating is ON ?
ifoff=>condition: heating is OFF ?
off=>end: Turn Off heating
e=>end: Turn ON heating


st->in1->iftemp->in2->ifpeople
iftemp(yes)->in2
iftemp(no)->ifon
ifpeople(no)->ifon
ifon(yes)->off
ifpeople(yes)->ifoff
ifoff(yes)->e

Resources
Wikipedia page on flowcharts.
draw.io web app to draw flowcharts

Coding control flow structures

Arduino structure reference.

Loops

while

while (condition) { // Do stuff }

for

for (int i=0; i<10; i++) { }

Conditionals

if

if (condition) { // Do stuff } else { // Do other stuff }

Basic key concepts

bool touched = true; int howMany = 3; float pressure = 5.67; char oneLetter = "a"; String message = "hello";

  • Libraries: Arduino libraries are a convenient way to share code such as device drivers or commonly used utility functions.

Select a repo