# Digital Pet on ATtiny85
A Tamagotchi-style virtual pet running on an ATtiny85 with a 128x64 SSD1306 OLED display. Built with [ssd1306xled](https://github.com/tejashwikalptaru/ssd1306xled).
Fits in 3 KB of flash and 42 bytes of RAM.
## How to play
- Press the **button** (or F key) to feed the pet
- Drag the **slide potentiometer** back and forth to play with it
- Keep both hunger and happiness bars filled or the pet gets sad and eventually falls asleep
## What happens
The pet is a small round blob that walks back and forth on a grassy ground. It has four moods:
- **Happy** -- both bars above 60%. Bounces around quickly with a wide grin.
- **Neutral** -- bars are okay but not great. Walks at a normal pace.
- **Sad** -- either bar drops below 25%. Stops walking, sits in the center, droopy eyes.
- **Sleeping** -- both bars hit zero. Curls up and shows "Zzz". Feed it or play with it to wake it up.
Feeding adds 25 hunger points and shows "Yum!" at the bottom. Playing with the potentiometer gradually increases happiness and shows "Whee!" while you're moving it. Both bars decay over time, so you need to check in regularly.
The buzzer chirps when you feed, plays a short melody on mood changes, and makes a sad descending tone when the pet gets unhappy.
## Screen layout
```
[food icon] [====hunger bar====] [heart icon] [===happy bar===]
( pet sprite )
Yum!
```
## About ssd1306xled
A lightweight OLED driver for ATtiny85 and other memory-constrained AVR microcontrollers. Bit-bangs I2C through the USI peripheral instead of using the Wire library, saving about 1 KB of flash.
- Source and docs: https://github.com/tejashwikalptaru/ssd1306xled
- API reference: https://tejashwikalptaru.github.io/ssd1306xled/
- More examples and games: https://github.com/tejashwikalptaru/ssd1306xled/tree/master/examples