Cigarette Box
The idea was to make a cigarette box for a person who wants to quit smoking. It contains the cigars in it so it detects each time you open the box to get a cigarette. Ideally, it would output how many times the box is opened, when it’s last opened (how many minutes passed since), a sad character if you open it too often, a happy character if you open it seldom. And it would play different sounds for different steps. One sound for 5th time, another more harsh one for 10th, harsher for 15 and a dying sound for 20.
However, the code that I am using to output the the number of counter messes up all other sound codes. It happens so randomly that I couldn’t fix. Also, the smiley faces appear like blinking, I can’t clear the LCD screen after each shape because I need the counter and message to stay there.
Now how it works: There’s a light sensor inside that detects if the box is opened or not. The LCD screen outputs the number of times the box is opened with a touchy message. It beeps each time you open the box, it beeps like an alert when you hit 5, 10, 15 times. There’s a smiley face in the beginning that welcomes, it turns into a sad face whenever you open the box and it turns into a laugh face when you do not open the box for a while. Right now, it’s 20 sec.
Soldering the LCD and getting it work
Outputting my own message on the screen
Getting the message but not getting the graphic in the same screen
Puff!!
No! It’s not acceptable!
Final look with flawed code
At least I have the text and smiley in the same screen. Even if it’s ghost like sometimes.
I was going to output a different message and sound each time the box is opened but couldn’t make it happen because the code that I’m using to output the integer into char is messing up the rest of my code 😦
Here is the code.







Reply