I would like to use image machine learning model to light up stars by hand gesture. Inspired by below video from YouTube.

First at all, I used Teachable Machine to train my model – to recognized zero to five for six hand gestures. Each class has about 127 samples to be trained.

Then wired up the leds and Arduino .

The result is not stable. Will do it again and upload video later….

https://editor.p5js.org/yac4/sketches/mGIVrYRNn

// Arduino UNO

int LEDs[] = {8,9,10,12,13};

void setup() {
  for(int i = 0;i<4;i++){
    pinMode(LEDs[i], OUTPUT);
    }
  
  Serial.begin(9600);        // initialize serial communications
}
 
void loop() {
 if (Serial.available() > 0) { // if there's serial data available
   int inByte = Serial.read();   // read it
   if (inByte > 0) {
      
      for(int i = 0;i<inByte;i++){
        digitalWrite(LEDs[i], HIGH);
   
    }
   
   } else {
     for(int i = 0;i<5;i++){
        digitalWrite(LEDs[i], LOW);
   
    }  
       // sets the LED off
   }
   delay(200);                // waits
 }
}