From 1d8a59c3a035aee3b3cf3a5a04c83e00f57edf92 Mon Sep 17 00:00:00 2001 From: DarkSpir Date: Sat, 6 Jan 2018 16:10:42 +0100 Subject: [PATCH] Update Readme Changed Binary size mentioned in text Added reset loop behavior and how to counter this --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b7ef2a..604849f 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ I modded a laser pointer module and a bright LED on my nerfgun, added two pushbu This little program reads inputs from the two pushbuttons, debounces them and controls the laser (one push = on, next push = off and so on) and the LED (one push = on, next push = random strobe mode, next push = off). When laser and LED are off, the program configures pinchange-interrupts for the two push buttons and put the microcontroller to sleep. You can wake it up by pushing a button (which will activate LED or laser, whatever you've pushed). My battery box has an on/off switch but I keep forgetting to switch it off. While the microcontroller is running and waiting for a button push, it pulls about 4mA continously until the battery runs dry. When it puts itself to sleep waiting for the next button push, it pulls below 100uA (which is the smallest current my multimeter can measure). -The program as it is now will not run on a Attiny25. It compiles to a binary containing 2106 bytes, the Attiny25 can store only 2048 bytes. I'm pretty sure you can optimize the code some more to free the necessary 58 bytes, but if it has to be quick and dirty, remove the sleep mode code and the includes for interrupt.h and sleep.h. That should reduce the code enough. +The program as it is now will not run on a Attiny25. It compiles to a binary containing 2092 bytes, the Attiny25 can store only 2048 bytes. I'm pretty sure you can optimize the code some more to free the necessary 44 bytes, but if it has to be quick and dirty, remove the sleep mode code and the includes for interrupt.h and sleep.h. That should reduce the code enough (although it means that your circuit will always draw power for the non-sleeping Attiny). + +Point of advise: The strobe mode is kinda noisy. If you ever notice that your circuit behaves unusual, it could be that the strobe mode switching the LED off drops enough interference to Vcc to send your Attiny into reset state. In my case Strobe seemed inaccessible and also turned off the Laser (due to the reset). If that happens you can fix this by adding a small capacitor between the reset pin and ground. In my case 10nF was not enough but 16nF did the trick. A big thank you to Thomas Ouellet Fredericks for his Bounce2 library (https://github.com/thomasfredericks/Bounce2) which I use in this project. That one is a great piece of software I use in almost all of my projects.