Project tutorial
The LumBox

The LumBox © GPL3+

A new toy for your kid(s) so you can watch your favorite TV show without being worried that your kid will be bored!

  • 2,224 views
  • 1 comment
  • 17 respects

Components and supplies

Necessary tools and machines

6x wood (for the box)
Soft fabric
Some fome to make the box softer

About this project

For school we had to make a toy for kids with sensors and an arduino, so we came up with the Lumbox!

This is how it works: when you start the game one of the six LED rings will light up, you have to push on the button this side. If you push on the right button you will get a point. You have 60 seconds to collect as many points as you can. Try and beat the highscore!

Code

LumBox Arduino
Here is the code for the Lumbox, copy it and upload it on your Arduino!
// 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);
}

Schematics

The circuit
The circuit used in this project:
Lumboxcircuit kdqm9fgxlw eaqf3hk2vn

Comments

Similar projects you might like

LCD Game

Project showcase by Iron_SalsaStudio

  • 12,948 views
  • 11 comments
  • 22 respects

Neopixel LED EyeBall

Project tutorial by HomeMadeGarbage

  • 6,911 views
  • 22 comments
  • 28 respects

Simple Arduino Optical Chopper

Project tutorial by Brendan Sweeny

  • 2,710 views
  • 0 comments
  • 6 respects

Servo Control Panel

Project tutorial by dancili

  • 2,276 views
  • 2 comments
  • 7 respects

Fidget Spinner RPM Counter

by Andriy Baranov

  • 54,355 views
  • 31 comments
  • 114 respects

Arduino Keyless Door Lock System with Keypad and LCD

Project tutorial by DIY Hacking

  • 36,307 views
  • 19 comments
  • 61 respects
Add projectSign up / Login