Sven Koene
Published

The Lumbox

The Lumbox is a fun toy for your kid to play with. It helps train his/her skills while you do your own thing.

IntermediateShowcase (no instructions)1 hour866
The Lumbox

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Resistor 10k ohm
Resistor 10k ohm
×6
Resistor 221 ohm
Resistor 221 ohm
×6
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
×1
LED-ring deck
Bitcraze LED-ring deck
×6
Big Red Dome Button
SparkFun Big Red Dome Button
×6

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Laser cutter (generic)
Laser cutter (generic)
wood triplex
2.5 cm thick foam
sewing machine

Story

Read more

Schematics

cicuit

Code

The Lumbox

Arduino
A toy for children. a random light will light up and you have to push the right button to get a point. this will repeat itself over the time of 1 minute
// include the library code:
#include <Adafruit_NeoPixel.h>
#include <LiquidCrystal_I2C.h>


int buttonPin = 8;     // the number of the pushbutton pin
int PIN = 2;           

Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);

// constants won't change. They're used here to set pin numbers:
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
// The LCD constructor - address shown is 0x27 - may or may not be correct for yours
// Also based on YWRobot LCM1602 IIC V1
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 

// variables will change:
int buttonState;         // variable for reading the pushbutton status
int historicState;
int randNumber;
int score = 0;

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Lets play a game!");
  //lcd.display();
  delay(500);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
  randomSeed(analogRead(0));
  
}

void loop() {
  // Turn off the display:
  //lcd.noDisplay();
  //delay(500);
  // Turn on the display:
  //lcd.display();
  //delay(500);
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);
  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
        //delay(1000);
      score++;
      lcd.clear();
      //lcd.display();
      lcd.print("Highscore: " + String (score));
      //lcd.display();
      strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);
      strip.begin();
      for(int i = 0; i < 12; i++){
        strip.setPixelColor(i, 0, 0, 0);
        strip.show();
        }
      randNumber = random(2, 8);
      Serial.println(randNumber);
      PIN = randNumber;
      buttonPin = randNumber + 6;
      strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);
      strip.begin();
      historicState = HIGH;
        for(int i = 0; i < 12; i++){
        strip.setPixelColor(i, 255, 0, 0);
        strip.show();
      
    }
    //Serial.println("buttonPin = " + String(buttonPin));
    delay(50);
  }
  delay(50);
}

Credits

Sven Koene
1 project • 0 followers
very interested and enthousiastic student on Rotterdam hogeschool.
Contact

Comments

Please log in or sign up to comment.