Tips & Tricks: Arduino Module

We take care of the electronics so you can focus on coding


Welcome to the wide world of Arduino! The Arduino At Heart™ module allows you to easily incorporate computer programming into your littleBits circuits. It is built upon the Arduino™ programming environment. If you’re new to programming microcontrollers, littleBits takes care of the electronics so you can focus on coding. All of the resources available for the Arduino community, including community support, can be utilized with this module. There are three inputs and three outputs so you can program advanced hardware interactions or communicate with software. You’re only limited by your imagination!

Ready to take your Arduino module for spin? Get up to speed on the basics by checking out our Getting Started Guide  and 10 introductory sketches, or viewing the setup video below!.

Hungry for more? Check out these tips & tricks:


Digital vs. Analog Input:

The Arduino Module can read two types of input signals. The first is digital, which is a simple “on” or “off” signal. This is the type of signal you will get from a button or trigger. In the Arduino coding language, on is a HIGH signal and off is a LOW signal. All three inputs on the Arduino Module can read digital signals.

The other type of signal is an analog signal. Analog signals aren’t just “on” or “off”. They work like a dimmer switch or a volume knob. In the Arduino coding language, analog signals are given a value between 0 and 1023. If you connected a dimmer module to your Arduino and turn the knob up (clockwise), the value would slowly rise from 0 to 1023. The inputs on the Arduino module marked a0 and a1 both accept analog signals.

Darth Vader and Luke Skywalker: Using Analog Input To Make Selections

In the example below we have two of our coin cell power modules hooked up to dimmer modules. One dimmer is turned down very low, and the other is turned up very high. You’ll notice that when we plug in the Darth Vader dimmer, the speaker connected to the Arduino plays his theme music. When we plug in Luke Skywalker, it plays Luke’s theme music. If, while the Luke Skywalker is plugged in, we turn his dimmer way down, the theme music changes (Oh no! Luke’s gone over to the Dark Side!).

photo 2

This project works by using an analog signal from the dimmer to choose which part of the program to run. We can set the parameters in the code. If the input is between 0 and 511, then Darth Vader’s music plays. If the input is greater than 511, then Luke Skywalker’s music plays.

With values ranging from 0 all the way to 1023, it’s possible to make a lot more than two selections using analog input. For our 8-bit Jukebox project, we used a light sensor and four different light filters to make four different selections using only one input.


One of the challenges to offering lots of different selections with an analog input like a dimmer is being able tell exactly what value you have selected. Attaching a number module to a dimmer can make it much easier. You’ll have an easy way to make up to 100 different selections.

photo 1

In our 8-bit Jukebox project, we wanted a way to choose between four different songs. We thought about just using four different buttons to make the selection, but there are only three bitsnap inputs on the Arduino Module, so we had to get creative.

Building Your Own Logic Modules

Our logic modules are a great way to build more complicated littleBits circuits. With some fairly simple coding, you can turn your Arduino module into any one of our logic modules. To do this, you’ll need to learn two basic concepts of Arduino coding.

The first are logical operators, or Boolean Operators, like “and,” “or,” and “not.” Check out Arduino’s tutorial on Booleans here.

The other code concept you will want to learn is the If statement. A basic If statement works like this: If A happens, then do B. Otherwise, do C. Check out Arduino’s tutorial on If statements here.

Putting the two concepts together, we could build lot’s of different logic modules. For example, here is a Double AND Module:

void setup()

pinMode(A0, INPUT);

pinMode(A1, INPUT);

pinMode(5, OUTPUT);

void loop()

if (digitalRead(A0) == HIGH && digitalRead(A1) == HIGH)


        digitalWrite(5, HIGH);

} else {

digitalWrite(5, LOW);


This code says, IF the input on pin a0 is high (“on”) AND the input on pin a1 is high, THEN send a high signal out of pin d5. If both inputs are not high, then send a low signal (“off”) out of pin d5.

Creating logic sketches like this is a great introduction to coding. Check out the tutorials for our logic modules and try modifying the code above to see which other modules you can recreate.

For support check out the littleBits and Arduino forums.

To learn more about coding, find examples on Arduino’s website.

More Tips & Tricks

Tips & Tricks
Friday’s Tips and Tricks: Play With Your Food!

Find out how to play with your food like a pro!

Tips & Tricks
Synth Tips & Tricks: Dress up your Knobs

We present a series of material explorations for enhancing the knobs on the Synth Kit modules to make for a fun and tactile intera...

Tips & Tricks
CodeKit Tips & Tricks

Get all the tips & tricks for your new Code Kit in one place