Make: Projects

MakerShield Tutorial

How to use the integrated potentiometer and push button to control the brightness and blink rate of the on-board LEDs.

  • By
  • Time Required: 15 to 30 min
  • Difficulty: Easy
MakerShield Tutorial



Step #1: MakerShield Feature

MakerShield Tutorial
  • The MakerSheild provides key components and corresponding pin-outs to facilitate easy prototyping.
  • Analog Potentiometer (Pot1), Simple switch button (Btn1), and two LEDs (LED1 and LED2).
  • Using only these four componenets and four wires we will control the brightness and blink rate using a sourced code.

Step #2:

MakerShield TutorialMakerShield TutorialMakerShield Tutorial
  • At the back end of the board, there is a pinout with 4 spots.
  • Insert the stripped end of a breadboard jumper wire into the LED1 spot, and the other end of the wire into the D6 pin.
  • Insert a second wire into the LED2 pin, with the other end running to D7 pin.
  • When we write out code, D6 and D7 will be the pins that control red and green LEDs that are mounted to the board.

Step #3:

MakerShield Tutorial
  • Next we will connect the push button into the board. Take the third wire and insert one end into the BTN1 pin and run the other end to the D0 pin.
  • The BTN1 provides a digital signal that the microcontroler can read. When the button is not pressed the circuit is open and produces a LOW signal.
  • Once the button is pressed, the circuit is closed and produces a HIGH signal. We will program the microcontroler to read these signal and assign different operations for each.

Step #4:

MakerShield Tutorial
  • The last connection we will make will be the Potentiometer. Take the 4th and final wire and connect it to the POT1 pin, running the other end of the wire to the A1 pin.
  • The potentiomter produces an analog signal. Unlike the digital HIGH/LOW signal of the push button, the microcontroller and read the voltage from the potetiometer and assign values from 1-###.
  • We will program the microcontroller to read the analog signal from the potetiometer and asign values that will correlate to two seperate variables. One variable will control the brightness of the LEDs, while the second variable will control the time blink rate of the LEDs.
  • Note: It is important to understand the difference between Analog and Digital signals, and learn to identify the corresponding components. The MakerShield has 6 analog pins (denoted with a capital A), and 14 digital pins (denoted with a capital D). If you were to plug in the potentiometer to a digital pin the micro-controller would not be able to assgin a value to. Similarly, if you plug in BTN1 to an analog pin the button would not function properly.

  • Hi, I can’t find the source code that the tutorial refers to. Is there a link somewhere or are we supposed to write the code on our own?

    • I probably should of posted this as a reply to you so you would get it… See comment below though.


    I don’t know where the source is but the above will do what you want. While you are pushing the button, the LEDs will blink back and forth with the brightness based on the potentiometer.

  • Shouldn’t there be a sketch to go with this…?

  • Zach Young

    This article is mostly pointless for beginners without the sketch.

  • Julian

    Here’s a working sketch for what he did.

    int led1 = 6;

    int led2 = 7;

    int buttonInput = 0;

    int potInput = A0;

    int potVal = 0;

    int ledVal = 0;

    void setup() {

    //Declaring Outputs and inputs

    pinMode(led1, OUTPUT);

    pinMode(led2, OUTPUT);

    pinMode(buttonInput, INPUT);

    pinMode(potInput, INPUT);


    void loop() {

    //Read Potentiometer, convert to a value between 0-255 and analog write out

    potVal = analogRead(potInput);

    ledVal = map(potVal, 0, 1023, 0, 255);

    analogWrite(led1, ledVal);

    //Determine if Button is pressed, and turn it off if it is.

    if (digitalRead(buttonInput) == LOW) {

    digitalWrite(led2, LOW);


    else {

    digitalWrite(led2, HIGH);