Writing my Name in Binary

Hey there fourum.arduino.cc

I'm trying to write my last name out in binary using this

This is what I have so far. I'm starting with the letter w. I have no coding experience whatsoever...

int led8 = 9;
int led7 = 8;
int led6 = 7;
int led5 = 6;
int led4 = 5;
int led3 = 4;
int led2 = 3;
int led1 = 2;

int W[ ] = {LOW, HIGH, LOW, HIGH, LOW, HIGH, HIGH, HIGH};

void setup() {


  pinMode(W, OUTPUT);
}

void loop() {
  
  digitalWrite(W, HIGH);

  delay(1000);

}

I could easily list out every digitalWrite and delay, but I want to use an array for each letter.
What stupid thing am I not doing?

Thanks!!!

sokuto:
I could easily list out every digitalWrite and delay, but I want to use an array for each letter.

It would be easier if the entire name was a char array and then use the built-in function "bitRead()" to dynamically determine which LED to light/dim. Also, it would be easier if the LED pins were in an array, too.

Like this (assuming LEDs are active high):

const byte leds[] = { 2, 3, 4, 5, 6, 7, 8, 9 };
const char name[] = "Willy Wonka";


void setup()
{
  for (byte i=0; i<sizeof(leds); i++)
    pinMode(leds[i], OUTPUT);
}


void loop()
{
  for (byte i=0; i<strlen(name); i++)
  {
    for (byte k=0; k<8; k++)
      digitalWrite(leds[k], bitRead(name[i], k));
    
    delay(1000);
  }
}

What stupid thing am I not doing?

It's more the stupid (no offense intendend) thing that you're doing :wink:

You're trying to pass an array as the first argument to a function that expects a non-array for the first argument.
W is an array with values LOW and HIGH (in Arduino that translates to 0 and 1).

In file -> preferences, you can set the warning level to ALL. Below the warning that indicates what goes wrong

warning: invalid conversion from 'int[b][color=red]*[/color][/b]' to 'uint8_t {aka unsigned char}' [-fpermissive]

   pinMode(W, OUTPUT);

So where do I put it? Seriously, I have no idea what i'm doing.

int led8 = 9;
int led7 = 8;
int led6 = 7;
int led5 = 6;
int led4 = 5;
int led3 = 4;
int led2 = 3;
int led1 = 2;



void setup() {

int W[ ] = {LOW, HIGH, LOW, HIGH, LOW, HIGH, HIGH, HIGH};

  pinMode(W, OUTPUT);

}

void loop() {
 
  digitalWrite(W, HIGH);

  delay(1000);

}

sokuto:
Seriously, I have no idea what i'm doing.

Then look at my first reply!!!