I just started with Arduino programming and currently I'm using this Sparkfun clone board:
It's really nice and like the way to program it and 'burn' it, it's easy to do. For the first project, I came along this instructable, an USB volume knob:
I'm using the Sparkfun Arduino programming IDE with added AdaFruit Trinket USB library (Trinket is also ATtiny85), download source, tweak it a bit to my needs and it's working perfectly. Had some programming question though, see also:
Anyway, optimized the source code (original not really a beauty), play with it and added also a fade-In/fade-out idle feature to the LED on PIN 1 and it blinks when turning the dial encoder.
I want to add add some more features to this knob, such as pushbuttons to change some internal modes. For example:
- Toggle button for knob sensitivity (3-modes: slow (default), normal, fast)
- A mute button
I want to that device 'remember' the state of the toggle button but there is no option (flash memory) to save the state. So I came with the idea to use a backup button cell to keep the device 'alive' when disconnected from USB (or computer turned off). A Button cell is 3V and USB is 5V so maybe is possible to 'test' the input voltage. If this is possible you can put the device in sleep mode (low power mode) directly after detecting USB connection lost and this voltage drop.
I have read already an article how to put the device into sleep mode (and awake from it):
Can I measure somehow the voltage is used to power the device? Any ideas (code example please if it is possible)?