#if defined(ESP32)
const int LED_PINS[] = {23,22,32,33,25,26,27,14,12,13};
#else
const int LED_PINS[] = {2,3,4,5,6,7,8,9,10,11};
#endif
const int NUM_LEDS = sizeof(LED_PINS)/sizeof(int);
uint16_t MASK = (1U << NUM_LEDS)-1;
String str;
void setup() {
Serial.begin(115200);
for ( int i=0; i < NUM_LEDS; i++ ) {
// set the direction of the i-th LED pin
pinMode( LED_PINS[i], OUTPUT );
// turn on the first LED (i=0) and the rest off.
digitalWrite( LED_PINS[i], (i==0) ? HIGH : LOW );
}
}
void loop() {
static uint16_t value=1;
for ( int i=0; i < NUM_LEDS; i++ ) {
digitalWrite( LED_PINS[i], (value >> i) & 1 );
}
str = "LEDs: value=0x";
str += String(value, HEX);
Serial.println( str.c_str() );
value = ((value << 1) | (value >> (NUM_LEDS-1))) & MASK;
delay(500);
}