Hey guys, just wanted to show you this. I made a "working" ammo counter using a BASIC Stamp Homework Board. The chip is built into a circuit with a solderless breadboard next to it, so you can make some cool prototypes. I'm too poor to buy all the stuff needed to make a "real" version, I made this out of stuff that came with the kit. If any of you guys have any experience with BASIC, feel free to make suggestions on the code, and I'll try them out.
It would be PROPER to solder everything together, then mount it in a gun, but this was just a starter kit, and I didn't want to solder anything, which is why it's on a board, and I technically can't solder it together into an "actual" circuit, because the chip is actually part of the kits prototyping board. I think that the kit was about $80, but it comes with a pretty good book, all the parts I used to make this, and some others. I got it at fry's.
It works quite well, I just noticed recently that you have to push the trigger button after it reaches zero, then the reload button will work, it won't work if you just scroll to zero, the trigger has to be pressed again.
The line where it says something like "When ammo is zero, push and release reload button to reload" can be modified and placed somewhere else to say "When reload button isn't being pushed, ammo is zero". This would be said, of course, in CODE. If you put the button in a place where the button would be pushed by the clip, then when you take out the clip, and put a new one in, the ammo counter would reset.
----------------------------------------------------------------------------------------------------------------------
' {$STAMP BS2}
' {$PBASIC 2.5}
ammoCounter VAR Byte
OUTH = %00000000
DIRH = %11111111
DO
FOR ammoCounter = 9 TO 0
LOOKUP ammoCounter, [ %11100111, %10000100, %11010011, %11010110, %10110100, %01110110,
%01110111, %11000100, %11110111, %11110110 ], OUTH
DEBUG " ", DEC2 ammoCounter, " ", BIN8 OUTH, CR
DO
LOOP UNTIL IN3 = 1
DO
LOOP UNTIL IN3 = 0
IF ammoCounter = 0 THEN DO
LOOP UNTIL IN4 = 1
DO
LOOP UNTIL IN4 = 0
NEXT
LOOP
----------------------------------------------------------------------------------------------------------------------Video:
I'm hammering out a few bugs on a slightly upgraded version, one that can use multiple clip starting ammounts.
Edited by Exo, 09 August 2011 - 05:58 PM.