Instructables
Picture of Arduino At Heart littlebits Quick Start
photo 1.JPG
photo 2.JPG

This instructable will enable you to code a simple digital and analog circuit as well as provide a starter sketch that you can use to get started quickly and also to debug your circuit. This Instructable is geared towards beginners and parents, the instructions should give you enough to get started in no time.

 
Remove these adsRemove these ads by Signing Up

Step 1: Initial Setup

Picture of Initial Setup

First, you will need to have the Arduino IDE downloaded from https://arduino.cc/download and running on your computer.

Next, you need to download the Quick Start Sketch from Github

https://github.com/ricklon/littlebitsatheart

There are two sketches we can use in the sketch folder:

startersketch.ino

The startersket.ino is a sketch that turns the Arduino into a "superbit" buttons and sliders on one side trigger a corresponding output action on the other.

starterdebug.ino

The starterdebug.ino is a sketch the uses the USB serial cable to communicate to the Arduino IDE serial terminal. Once it is loaded you can view the serial terminal and see what values are being input to the Arduino and then read the values that are sent to the output side of the Arduino. This way you can tell if your input bits have power and are giving you the correct information. As well as, being able to tell if the output side of the Arduino sending the right kind of signals to the connected bits.

All of the getting started examples use can be done with either starter sketch. However, in each step we will show the minimum sketch for each example.

For this quick tutorial, you will need the following littleBits:

Starter Sketch Code:

  //declare Inputs
  //lower case a0, d1 is not defined. d0 is not defined.
  int valA0;
  int valA1;
  int valD0;
  
void setup() {
  //pin mode OUTPUT data or energy out
  pinMode(1, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(9, OUTPUT);

  //pin mode INPUT data or energy in
  pinMode(0, INPUT);
  //usually you don't need to set analog pinmode because they always take data in

}


void loop() { 
  //get Inputs
  //lower case a0, d1 is not defined. d0 is not defined.
  valA0 = analogRead(A0);
  valA1 = analogRead(A1);
  valD0 = digitalRead(0);


  //interact with world
  //scale the values for the proper OUTPUT
  //do not have to scale digital INPUT D0
  int mapA0 = map(valA0, 0, 1023, 0, 255);
  int mapA1 = map(valA1, 0, 1023, 0, 255);
  
  //send Outputs
  digitalWrite(1, valD0);
  analogWrite(5, mapA0);
  analogWrite(9, mapA1);

}

Nice quick start guide! Thanks for posting!

ricklon (author)  Danger is my middle name3 months ago

Thanks if you have any questions let me know.