Introduction to Arduino Programming 1: The Basics

Arduino Programming Basics

So you’ve just unboxed your shiny new littleBits Arduino module and would like to get into the fabulous world of Computer Programming, or you’re already an experienced programmer and want dip your toe into coding an Arduino, we’ll be covering how you can get from 0 – 💯 in no time.


What does the Arduino module do anyway?

In short the littleBits Arduino at ❤ module enables you to learn programming, code physical games, and connect your littleBits modules to pretty much any software running on your computer.

How does it work?

Think of the Arduino Bit as a little kid. If we need it teach it something, like riding a bike ( or move a servo motor ) we’ll have to give it commands. It’ll use it’s sense of touch and feel through the inputs and outputs of our littleBits circuits

The other important thing to remember is that the Arduino can store memory and make decisions. So if you’re playing a game, it can decide if you won a game or not and keep track of the game’s score.

ID what?!

To program the Arduino we need special software that will let us connect to the Arduino so we can code it. IDE stands for Integrated Development Environment. Let’s break down that down:

DEVELOPMENT stands for software development or coding. We use code to create programs.

ENVIRONMENT is exactly what it means, humans exist in a environment that’s made up of oxygen and water + lots of other stuff we need to live. In computer programming an environment includes all the things we need to code our Arduino in it’s little Arduino world.

INTEGRATED means that everything you need to code is all one place.

If you’d like to learn more I highly recommend reading the documentation for the Arduino Development Environment.

Let’s get our hands programmy

Let’s get started, first we need to download the Arduino IDE you can find it here!

Before we get coding we need to setup our circuit. Let’s take a look at the Arduino:

We can see that our module has a set of inputs one side and a set of outputs on the other. And the USB port let’s us program the Arduino from our computer.

All we have to do now is grab our p1 POWER Bit (blue), our ARDUINO Bit (orange) and a micro USB cable. Make sure you’ve turned on your power bit and plugged in your USB cable.


It’s… ALIVE (almost)


Ok now our Arduino won’t do much because just like our friend Frankenstein we’ll need to give it some commands so it can do some work, BUT before we can do that there’s one more step.

We need to tell the IDE what Arduino we’re using and how we’re communicating with it. So that means selecting our board which is based off of the Arduino Leonardo. Then we select port (our communication method) we’ll be send our code through. Which is “tty.usbmodem…” for Mac, “cu.usbmodem…” for Windows.

Flipping the programming switch

Ok now we need to check everything is order we press the ❤and hopefully you’ll see some lights blink on your Arduino and we’ll have our very first program flashed!

The Arduino is equipped with a tiny bit of memory that allows it to save our program so when we unplug the device and turn it back on it will run program that was last uploaded.

If things go wrong don’t fear, let’s do a little troubleshooting:
– Make sure that your Arduino is powered on before you open your IDE.
– Try restarting the Arduino software.
– Try restarting your computer.
– Unplug your Arduino and plug it back in.
– Make sure the right port and board are selected.
– If all else fails check out our troubleshooting guide



Now just like our friend Frankenstein we need to load software on to our Arduino Bit’s baby brain and teach it to do things. So let’s get down to some coding!


Ok so we’re learning how to code now. We need to teach our Arduino to do things but only way we can do that is to speak it’s language. And just like learning any new language we need to learn it’s rules. In computer programming those rules are called syntax.


The rules of the road

Firstly you’ll notice that the words void and setup,

as well as void and loop,

are both highlighted. This is called syntax highlighting, it means those words are special keywords that give the Arduino a specific command. void setup() is a function.

A FUNCTION is a lot like a blender it takes in some ingredients and gives us something delicious like so:


In addition to the name of the function we need to tell the Arduino what kind or type of function we want, in this case we’ll be using void. We won’t dive deeply into types. of functions (yet!) but just know that they come before setup() and loop() right now.


What’s in a name?

Now that we have the type of function, we need to code the rest of it. Let’s take a look at setup. Just like it’s name implies it helps us setup our program.

And just like we need a mouth to speak, the code to setup our program will allow our Arduino to speak.

The section after the parentheses ()

and in between the curly braces { }

is where we will write our first line of code that will enable the Arduino to talk to us.

it’s called Serial.begin().

SERIAL is a command that defines how we’ll be communicating to our computer.

Serial? As much fun as cereal but without the sugar!

We have a pipe between our computer and the Arduino which is our USB cable but we need to tell the computer what will be running through that pipe, water? Oil?

In this case we’re using serial no not the stuff you eat but a form of communication that let’s us upload to the Arduino.

.begin(9600) tells the Arduino to start the communication. You’ll notice that there is a dot that separate’s Serial and begin that is yet another syntax rule. Don’t worry you’ll remember all of this as you keep coding!

The 9600 tells the Arduino how fast it should talk to us. For most of the most part 9600 for what we’re going to be doing.

NOTE: Right after our function name we have two parentheses every function has them just like you have a type and a name. Think of it as a punctuation mark. More on that in a bit.

Our second command is the loop() just like it implies it runs code over and over again. Just like like our circulatory system is a loop, the code inside of the loop is pumped through our program. In this case we’re pumping code through the Arduino’s veins. Serial.println(“hello littleWorld!”); is the command that we us to tell the Arduino to speak. Inside of the double quotes is where we put our message!

Let’s fire it up!

Once you’ve typed up the sample code, hit the upload button found in the tool bar. It looks like this: ❤and then open the serial monitor ❤

Why you bugging?

In case you’re seeing errors like this:



Or just can’t upload:

Check out our guide on how to troubleshoot these issues.

Change your message!

Each time you make changes to your code don’t forget to upload.

Why we do the things we do.

This code is an example of how you can communicate with your Arduino. And use that to talk to other programs on your computer like processing…etc.

You made it!!!

Congrats we’re one step closer to being Arduino pros!

Here’s an emoji for all your hard work: 🎊


Watch the video!

And another!


  • Install this!
  • Choose the right Arduino board and port.
  • Power and hook-up the Arduino to your computer.
  • Type in the sample code, then hit upload ❤.
  • Check out your message in the serial monitor ❤.
  • If you have trouble try restarting your computer, or reseting your Arduino by unplugging and replugging it. Look for syntax errors, the line number is on the bottom left and printed in the console.

More Tips & Tricks

Tips & Tricks
Tips & Tricks: Makey Makey Bit

MEET THE BIT The MAKEY MAKEY Bit turns everyday conductive objects (like bananas) into triggers that control your circuit and even...

Tips & Tricks
Temperature Sensor

The temperature sensor responds to the temperature surrounding its probe. The higher the temperature it senses, the more signal it...

Tips & Tricks
The cloudBit + IFTTT

IFTTT (If This Then That) is a service that lets you connect to different web apps and select IoT products through simple conditio...