Stranger Things alphabet scenes

Totally new to this forum and to programming arduino.
I want to make a stranger things alphabet light string for a prop, I would light to run a few scenes so the lights will spell out a couple words, "run, hello, etc" without having to manually trigger each light but instead maybe pushing one button that will run the scene.

I would be controlling a handful of lights and from what I understand I can use shift registers to control the extra lights but what about the code for the scenes?

I realize I'm probably in the wrong place on the forum but it seemed most fitting in case there were other ideas to control the individual lights, any links, and ideas, anything would be a great help!

Thank you!

No idea what a 'stranger things' is and what a 'prop' is; English is not my native language.

Maybe some of the info in 74HC595 with delay() - LEDs and Multiplexing - Arduino Forum can be of use.

For the pushbutton that's simple if you DO NOT want to do toggle button, here is a sample from the examples in the arduino ide for push button:

const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);     
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}

Toggle button example here

Also since this I assume is going to have an LCD screen or something like it, and you said you are new, it's probably not good for you. Lcd are kinda of hard to do.

If not, could you please explain, or draw a small diagram to show us what is that you want to do?

So it would look like this. Stranger things is a show released on Netflix this year.
One of the characters talks to her son who's in another dimension through these lights of which he spells out the word he wants to say.

I want to have a scene programmed to spell out a few words, the program would be triggered by a physical button that would play a sequence that would for example, light up "r. u. n." All separate, so the r would turn on for a half a second, then the u, etc.

Basivally. Thank you for the replies you guys.

So one led on would indicated the letter A, another one on the letter B and so on?

Have you had a go at the shift register approach? Which shift registers are you using (or planning to use)?

Sorry for not knowing about that show, but my facebook slogan is "television is a waste of time" ') And that for somebody who has worked the last 20 years in the pay television industry :smiley:

Maybe you should consider ws2812b leds. These can be strung on a line and you can control each led individually using one Arduino pin and no extra chips.

[ws2812b on small pcbs](http://www.ebay.co.uk/itm/50pcs-WS2812B-LED-With-Heatsink-10mm-3mm-DC5V-5050-SMD-RGB-Pixel-Light-DE-/262237021349?
hash=item3d0e8b64a5:g:hgMAAOSwbYZXbIug)

sterretje:
So one led on would indicated the letter A, another one on the letter B and so on?

Have you had a go at the shift register approach? Which shift registers are you using (or planning to use)?

Exactly! I would love to have all letters programmable but at the very least would only need 3.

I have considered shift registers, I've never used one but through my research so far it seems like the best way to address each light separate, though I may look into these individually addressable rgbs Paul has suggested.

I guess now my concern is in the programming, of which my research has just begun. I'd like to program a few scenes so that I wouldn't have to trigger each light by hand

sterretje:
Sorry for not knowing about that show, but my facebook slogan is "television is a waste of time" ') And that for somebody who has worked the last 20 years in the pay television industry :smiley:

I'm guessing they pay you very well, then.

There are 26 letters in the alphabet. In a computer, they are stored as numbers (that is the only thing a computer knows). The letter 'A' has the value 0x41 (hex; 65 decimal), 'B' has the value 0x42 (hex; 66 decimal).

You can find this at e.g. http://www.asciitable.com/

So to determine which led must be on, you can simply subtract the value from the letter.

// the duration that each character must be displayed
#define DISPLAYTIME 1000UL

void displayCharacters(char *txt)
{
  // inde into character array
  int index = 0;
  // display led number for each character in txt till end of string is detected
  while (txt[index] != '\0')
  {
    // // print character and led number
    Serial.print("character: "); Serial.print(txt[index]);
    Serial.print(", led: "); Serial.println(txt[index] - 'A');
    // prepare for next character
    index++;
    // display character for specified time
    delay(DISPLAYTIME);
  }

  Serial.println("DONE");
}

void setup()
{
  char text[] = "ABC";
  Serial.begin(115200);

  displayCharacters(text);
}

void loop()
{

}

Note: computers count from zero, so led 0 is the first led

The above code uses a function to display the characters. One of the advantages of the use of the function is that you only have to change that function based on the hardware that you decide to use.

The code uses delay to implement the wait time that a character must be displayed. The disadvantage is that this blocks processing, so if you e.g. need to process a button press to cancel, the detection of the button press will only happen once all characters are displayed. We can take that hurdle when needed

You might also want to add a visual indication to separate words (e.g. a longer delay); the below displayCharacters() function handles that.

void displayCharacters(char *txt)
{
  // index into character array
  int index = 0;
  // display led number for each character in txt till end of string is detected
  while (txt[index] != '\0')
  {
    if (txt[index] == ' ')
    {
      // wait longer for a space
      delay(DISPLAYTIME * 5);
    }
    else
    {
      // print character and led number
      Serial.print("character: "); Serial.print(txt[index]);
      Serial.print(", led: "); Serial.println(txt[index] - 'A');
      // wait a little while
      delay(DISPLAYTIME);
      // for 'stranger things', clear all leds
      Serial.println("leds cleared");
    }

    // prepare for next character
    index++;
  }
}

Lastly, you can use multiple texts. You can do this by using an array (of pointers to) texts.

// the duration that each character must be displayed
#define DISPLAYTIME 1000UL

// the texts to display; you can expand 'unlimited'
char *texts[] =
{
  "HELLO WORLD",
  "STRANGER THINGS",
};

Your setup can now basically be empty as the displaying will be done from loop().

void displayCharacters(char *txt)
{
  // as is
  ...
  ...
}
void setup()
{
  Serial.begin(115200);
  Serial.print("Number of texts: "); Serial.println(sizeof(texts) / sizeof(texts[0]));
}

void loop()
{
  // keep track which text to display
  static int index = 0;

  Serial.print("Sending '"); Serial.print(texts[index]); Serial.println("'");
  // display indicated text; also increment the index so the next time the next text will be displayed
  displayCharacters(texts[index++]);

  // delay between texts (10 seconds)
  delay(10000);

  // if end of texts is reached, reset
  if (index >= sizeof(texts) / sizeof(texts[0]))
  {
    index = 0;
  }
}

Hope this gets you a little on track.

Depending on needs, this can require further finetuning; getting rid of delays is one and possibly storing texts in eeprom would be a nice feature.

odometer:
I'm guessing they pay you very well, then.

Can't complain $$$