Arduino Nano test circuit.Fig. 1

Arduino XOR Blinks LED

by Lewis Loflin

This is part of a series on code snippets for Arduino. Many visitors to my You Tube Channel and this website are beginners. They have limited knowledge of programming or hardware. This requires learning both.

Think of a micro-controller as a box full of basic logic circuits, gates, etc. To control the "box" we have to tell it what hardware to use. We must tell the "box" how to manipulate the gates and hardware. that is what machine code does.

I am using compiler Arduino-1.6.3. Results may vary with other compilers or a non-Nano Arduino board.

Fig. 1 shows the test setup for this series, in this case an Arduino Nano. I'll assume one can program their Arduino board. The Nano and most Arduino boards today have an LED on digital pin 13 (DP13).

Arduino uses a variation of C/C++ a complied language. That means the written code usually as a text file. This text file is "compiled" etc. to machine code that is written to the hardware. While C/C++ are much the same across most micro-controllers, the machine code is not.

The sequence is 1) write code text file (.ino for Arduino), 2) it is checked and compiled, 3) machine code uploaded to Arduino.

A few notes on this. "HIGH" can be replaced with "1"; "LOW" can be replaced with "0". So digitalWrite(LED, HIGH) is the same as digitalWrtie(LED, 1). Same with LOW and 0.

In the electrical sense a HIGH or 1 is 5-volts; a LOW or 0 is 0-volts or ground.

And "true" can be replaced by "1" or any non-zero number; "false" can be replaced by "0". I'll look at code for that as well.