Final project (initial) progress

I want to build off of this code that was on ml5js. I need to train the program to recognize the different hand gestures (rock, paper, scissors).

I started with the Arduino part of the ‘rock, paper, scissors’ game, by trying to build a reward system. When the project is complete, the green LED should light up whenever the user wins a round, and the red LED should light up whenever the user loses a round. And if the user wins the game (eg. wins 5 rounds before the computer) he/she receives  candy that is hidden under the box (video link below).

#include <Servo.h>

Servo servo;
int servoPos = 100;
int gameOver = 1 ;

int gledPin = 2;
int rledPin = 4;
int winloss = 1;

void setup() {
  servo.attach(9);  
  pinMode(gledPin, OUTPUT);
  pinMode(rledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  if (gameOver == 1){
    servoPos = 20;
    servo.write(servoPos);
    }
   servoPos = 100;
   servo.write(servoPos);

  if (winloss == 0){
    digitalWrite(rledPin, HIGH);
    }
   else{
    digitalWrite(gledPin, HIGH);}

  delay(2000);
  
}

https://youtube.com/shorts/Zce_tFlzj7E?feature=share

Leave a Reply