Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Rebecca Deprey
Published

Adding LEDs to a Cross-Stitch Picture

You can add LEDs to your cross-stitch project using an Arduino LilyPad and conductive thread.

BeginnerFull instructions provided2 hours4,437
Adding LEDs to a Cross-Stitch Picture

Things used in this project

Hardware components

Arduino LilyPad USB
Arduino LilyPad USB
×1
Sewable Conductive Thread
Sewable Conductive Thread
×1
LilyPad LED Blue (5pcs)
SparkFun LilyPad LED Blue (5pcs)
×1
SparkFun E-Textiles Battery - 110mAh (2C Discharge)
×1

Story

Read more

Schematics

Daisy Chain LED Connection Diagram

An example of how you can daisy chain the LEDs to control them from a single pad on the LilyPad.

Code

Code snippet #3

Plain text
// Runs once
void setup() {
  // Set strands as outputs
  pinMode(lightStrand1, OUTPUT);
  pinMode(lightStrand2, OUTPUT);

  // Initialize Serial, set the baud rate to 9600 bps
  Serial.begin(9600);
}

Code snippet #4

Plain text
// Runs once
void setup() {
  // Set strands as outputs
  pinMode(lightStrand1, OUTPUT);
  pinMode(lightStrand2, OUTPUT);

  // Initialize Serial, set the baud rate to 9600 bps
  Serial.begin(9600);
}

Code snippet #5

Plain text
void loop() {
  // Pauses the loop for 1.5 seconds
  delay(1500); // milliseconds

  // Setting lightStrand1 to HIGH turns ON the LEDs connected to pin A4
  // Setting lightStrand2 to LOW turns OFF the LEDs connected to pin 3
  digitalWrite(lightStrand1, HIGH);
  digitalWrite(lightStrand2, LOW);

  // Pauses the loop for 1.5 seconds
  delay(1500); // milliseconds

  // Setting lightStrand1 to LOW turns OFF the LEDs connected to pin A4
  // Setting lightStrand2 to HIGH turns ON the LEDs connected to pin 3
  digitalWrite(lightStrand1, LOW);
  digitalWrite(lightStrand2, HIGH);
}

Code snippet #6

Plain text
void loop() {
  // Pauses the loop for 1.5 seconds
  delay(1500); // milliseconds

  // Setting lightStrand1 to HIGH turns ON the LEDs connected to pin A4
  // Setting lightStrand2 to LOW turns OFF the LEDs connected to pin 3
  digitalWrite(lightStrand1, HIGH);
  digitalWrite(lightStrand2, LOW);

  // Pauses the loop for 1.5 seconds
  delay(1500); // milliseconds

  // Setting lightStrand1 to LOW turns OFF the LEDs connected to pin A4
  // Setting lightStrand2 to HIGH turns ON the LEDs connected to pin 3
  digitalWrite(lightStrand1, LOW);
  digitalWrite(lightStrand2, HIGH);
}

Gist

https://gist.github.com/rdeprey/a1cdae2d609214215d2c5005d338ee35

Credits

Rebecca Deprey

Rebecca Deprey

2 projects • 6 followers
Software engineer and IoT/hardware tinkerer. Lover of all things tech, photography, travel, and books. @RadiantSunrise on Twitter.

Comments