Introduction

The EagLED is an e-textile development kit which includes a push button and several LEDs. Previously, you might have already learned to use a pushbutton with the EagLED. 

In this guide, learn to connect an LED and a pushbutton with the EagLED by using conductive thread. You will create a simple circuit that will be powered with a coin cell battery.

Complete this guide to master the basics and go on with incorporating buttons and LEDs in your wearable electronic projects.
    • In this guide, we'll learn to use the EagLED with a pushbutton and LED.

    • For this guide, you'll need the EagLED's main board, one of its eye-shaped LEDs, a coin cell battery holder, a CR2032 coin cell battery, alligator clips for the prototyping process, conductive thread and sewing needle, fabric of your choice and some fabric scissors.

    • First, let's start with the prototype. Get out the alligator clips and connect the LED to the EagLED. Connect '+' on the LED to '#3' on the EagLED.

    • Then, connect '-' on LED to 'GND' on EagLED.

    • Now connect the button to the EagLED. First, connect a yellow alligator clip from the button to '#6'.

    • Next, connect a red alligator clip from the button to '3.3V' on the EagLED.

    • Then connect a black alligator clip from the button to 'GND' on the EagLED.

  1. const unsigned int buttonPin = 6;
    const unsigned int ledPin = 3;
    
    int buttonState = 0;
    int oldButtonState = LOW;
    int ledState = LOW;
    
    void setup() {
      pinMode(ledPin, OUTPUT);
      pinMode(buttonPin, INPUT_PULLUP);
    }
    
    void loop() {
      buttonState = digitalRead(buttonPin);
    
      if (buttonState != oldButtonState &&
          buttonState == HIGH)
      {
        ledState = (ledState == LOW ? HIGH : LOW);
        digitalWrite(ledPin, ledState);
        delay(50);
      }
      oldButtonState = buttonState;
    }
    • Upload this code to the EagLED and test out the prototype.

    • In this guide, a rectangular cut out from a sheet of felt fabric is used to create the wearable. The EagLED is then sewn onto the inner side, and the LED is sewn onto the outer side.

      First, create three loops around each sew tab on the EagLED. 

    • Then poke the sewing needle through to the outer side to meet the LED.

    • Connect '#3' on EagLED to '+' on the LED.

    • Connect 'GND' on EagLED to '-' on LED.

    • Next, connect the EagLED to the button. The button is sewn on the outer side:

      '#6' 

      ''3.3V'

      'GND'

    • Connect '+' of coin cell battery holder to '3.3V' on the EagLED.

    • Then connect '-' of the coin cell battery holder to 'GND' on the EagLED.

    • Insert the CR2032 battery into the coin cell battery holder. 

    • Flick the switch to 'ON' on the EagLED and battery holder. The LED should light up on button press!