Counter Box/Magic box/treasure box

SRJT09203

Jugaadu's friend Sameer likes collecting antiques. He stores these antiques in a box. His target is to collect 100 items before opening the box. Sameer lost the track of the antiques stored in his box. Now he is worried about how can he keep a track of the items in the box. He needs help from Jugaadu to help him to track the count of antiques. Let's help him out with the treasure?

Bag items:

  1. IR sensor
  2. Scissors
  3. Arduino UNO UNO
  4. Jumper Cables
  5. USB cable
  6. 12V Battery
  7. Carton box
  8. 7 segment Display
  9. Glue gun
  10. Tape
  11. Cutter
We can use IR to identify the presence of stuff and for number display, we can use 7 Segment LED display. For every product, the counter will increase by value one.

    #include 
#include 
#define CLK 9
#define DIO 8
#define TEST_DELAY 2000
TM1637Display display(CLK, DIO);
int IR=13;
int i=0;
void setup()
{
pinMode(12,OUTPUT);
pinMode(11,OUTPUT); 
pinMode(IR,INPUT);
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
}
void loop()
{
display.setBrightness(0x0f);
uint8_t data[] = { 0x0, 0x0, 0x0, 0x0 };
display.setSegments(data);
if(digitalRead(IR)){
display.showNumberDec(i);
}else{
i=i+1;
display.showNumberDec(i);
delay(100);
}
}