[RESOLVED] Serial Monitor LEDs

Hi I found this on a web page :

int latchPin = 5;
int clockPin = 6;
int dataPin = 4;
 
byte leds = 0;
 
void setup() 
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  updateShiftRegister();
  Serial.begin(9600);
  while (! Serial); // Wait untilSerial is ready - Leonardo
  Serial.println("Enter LED Number 0 to 7 or 'x' to clear");
}
 
void loop() 
{
  if (Serial.available())
  {
    char ch = Serial.read();
    if (ch >= '0' && ch <= '7')
    {
      int led = ch - '0';
      bitSet(leds, led);
      updateShiftRegister();
      Serial.print("Turned on LED ");
      Serial.println(led);
    }
    if (ch == 'x')
    {
      leds = 0;
      updateShiftRegister();
      Serial.println("Cleared");
    }
  }
}
 
void updateShiftRegister()
{
   digitalWrite(latchPin, LOW);
   shiftOut(dataPin, clockPin, LSBFIRST, leds);
   digitalWrite(latchPin, HIGH);
}

If i wanna change the numbers in letters how the program should look??

What? :astonished:

If i wanna change the numbers in letters

What do you mean by that?

If i wanna change the numbers in letters

Do you mean change the numbers (0 to 7) to letters (say ‘a’ to ‘h’)? If so,

    if (ch >= '0' && ch <= '7')

becomes

    if (ch >= 'a' && ch <= 'h')

I’m willing to be that you can figure out what to change here:

      int led = ch - '0';

Hint: ‘a’

SRY.. Never min....

lori3:
SRY… Never min…

So . . ?