Controlling 27 leds over serial port

Hey guys so I’m trying to make a script that controls 26 leds alike to how this script controls one

Ive looked at led strips but I cant seem to find much on how to code it for what I need.

Can anyone offer any hints or tips on where to look ?

will be using an uno I know the mega might let me get a way with it but I think its sorta over kill for what I want

 char INBYTE;
 int  LED = 13; // LED on pin 13

 void setup() {
   pinMode(LED, OUTPUT);


 void loop() {
  Serial.println("Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF:");
  while (!Serial.available());   // stay here so long as COM port is empty   
  INBYTE =;        // read next available byte
  if( INBYTE == '0' ) digitalWrite(LED, LOW);  // if it's a 0 (zero) tun LED off
  if( INBYTE == '1' ) digitalWrite(LED, HIGH); // if it's a 1 (one) turn LED on

Do you mean a strip of LEDs such as WS2812B? These are a controller with drives 3 LEDs, you send it 3 bytes and it controls its 3 PWM outputs to one of 256 brightness levels.

To control them, look at Neopixel library, or Fastled.h library on github

If you just want on/off control on single color LEDs, then wiring 27 up to a MAX7219 would be pretty easy, I even offer a breakout board that lets you take 2 wires to each LED


Or you could use 4 shift registers to do the same thing discretely for up to 32 LEDs. If you do, please remember to use a current limit resistor for each LED.

yeah so what I need is on off control for 27 leds

so after looking at the options you gave me I understand how the wiring of both the MAX7219 and shift registers work

but I can not quite get my head around how to program it

I know how to change the code ive got to use more leds but I dont think that is enough once I start using many more.