Increment (Teaching Computers to Count)

Increment just means to add numbers over and over to a total;

1+1 = 2+ 1 = 3 + 1= 4….. and so on…

There are several ways to increment a variable in C++ (on an Arduino). Here’s one way:

int x = 0;
void setup() {
}
void loop() {
   x = x + 1;
}

In this example, every time loop() is called (which will be hundreds of times a second) … x will be increased by 1.

Other ways to increase x by 1 are the following (all of these do the same thing, it is just that their syntax is different): x++; and x+=1;