Help with SPI for 74HC595

Hello. I have a question. How in this code it is possible to make that 0 turned into 1? (74x595). That is, I have a running light that goes like 1 need to be on the contrary with 0 clicks. I just have transistors in front of the LEDs. And still it is possible to make that it any code translated so. Ie add some code when transferring to registers?

#include <SPI.h>

enum { REG = 8 };


/* Теперь шлём по 16 бит. Важный момент: так как по умолчанию
 * данные передаются, начиная со старшего бита, сначала нужно
 * послать старший байт, затем - младший - тогда всё 16 бит
 * передадутся в правильном порядке.
 */
void writeShiftRegister16(int ss_pin, uint16_t value)
{
  digitalWrite(ss_pin, LOW);
  /* Фокус вот в чём: сначала шлём старший байт */
  SPI.transfer(highByte(value));
  /* А потом младший */
  SPI.transfer(lowByte(value));
  digitalWrite(ss_pin, HIGH);
}


void setup()
{
  SPI.begin();

  pinMode(REG, OUTPUT);
  
  writeShiftRegister16(REG, 1);
}


/* Слегка изменим функцию для работы с 16-битными значениями */
void rotateLeft(uint16_t &bits)
{
  uint16_t low_bit = bits & (1 << 15) ? 1 : 0;
  bits = (bits << 1) | low_bit;
}


void loop()
{
  static uint16_t nomad = 1;

  writeShiftRegister16(REG, nomad);
  rotateLeft(nomad);

  delay(300 / 8);
}

You can invert all the bits in a variable like this:

var = ~var

aarg:
You can invert all the bits in a variable like this:

var = ~var

do not tell where exactly it is necessary to put this

muse009:
do not tell where exactly it is necessary to put this

In between where you calculate var, and where you use var.