Articles Posted by the Author:

  • += , -= , *= , /=

    += , -= , *= , /=

    Description Perform a mathematical operation on a variable with another constant or variable. The += (et al) operators are just a convenient shorthand for the expanded syntax, listed below. Syntax x += y; // equivalent to the expression x = x + y; x -= y; // equivalent to the expression x = x - […]


  • ++ (increment) / — (decrement)

    ++ (increment) / — (decrement)

    Description Increment or decrement a variable Syntax x++; // increment x by one and returns the old value of x ++x; // increment x by one and returns the new value of x x-- ; // decrement x by one and returns the old value of x --x ; // decrement x by one and […]


  • bitshift left (<<), bitshift right (>>)

    bitshift left (<<), bitshift right (>>)

    Description There are two bit shift operators in C++: the left shift operator >. These operators cause the bits in the left operand to be shifted left or right by the number of positions specified by the right operand. More on bitwise math may be found here. Syntax variable > number_of_bits Parameters variable: (byte, int, […]


  • Bitwise NOT (~)

    Bitwise NOT (~)

    The bitwise NOT operator in C++ is the tilde character ~. Unlike & and |, the bitwise NOT operator is applied to a single operand to its right. Bitwise NOT changes each bit to its opposite: 0 becomes 1, and 1 becomes 0. For example:          0    1      operand1          ———-          1 […]


  • Bitwise AND (&), Bitwise OR (|), Bitwise XOR (^)

    Bitwise AND (&), Bitwise OR (|), Bitwise XOR (^)

    The bitwise operators perform their calculations at the bit level of variables. They help solve a wide range of common programming problems. Much of the material below is from an excellent tutorial on bitwise math wihch may be found here. Description and Syntax Below are descriptions and syntax for all of the operators. Further details […]


  • The pointer operators  & (reference) and * (dereference)

    The pointer operators & (reference) and * (dereference)

    Pointers are one of the more complicated subjects for beginners in learning C, and it is possible to write the vast majority of 86Duino sketches without ever encountering pointers. However for manipulating certain data structures, the use of pointers can simplify the code, and knowledge of manipulating pointers is handy to have in one’s toolkit. […]


  • Boolean Operators

    Boolean Operators

    These can be used inside the condition of an if statement. && (logical and) True only if both operands are true, e.g. is true only if both inputs are high. || (logical or) True if either operand is true, e.g. is true if either x or y is greater than 0. ! (not) True if […]


  • if (conditional) and ==, !=, <, > (comparison operators)

    if (conditional) and ==, !=, <, > (comparison operators)

    if, which is used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number. The format for an if test is: The program tests to see if someVariable is greater than 50. If it is, the program takes a particular action. Put […]


  • % (modulo)

    % (modulo)

    Description Calculates the remainder when one integer is divided by another. It is useful for keeping a variable within a particular range (e.g. the size of an array). Syntax result = dividend % divisor Parameters dividend: the number to be divided divisor: the number to divide by Returns the remainder Example Example Code Tip The […]


  • Addition, Subtraction, Multiplication, & Division

    Addition, Subtraction, Multiplication, & Division

    Description These operators return the sum, difference, product, or quotient (respectively) of the two operands. The operation is conducted using the data type of the operands, so, for example, 9 / 4 gives 2 since 9 and 4 are ints. This also means that the operation can overflow if the result is larger than that […]