I posted about this a while ago pertaining to a different question related to this project. To my dismay, my question was never answered. But luckily, about two weeks later, I found out the issue. But I’ve now been confronted with a different, more difficult problem.
Here’s the basics of how it works:
I am trying to duplicate a project I did with my BS2e (BASIC Stamp II model E), except this time, I am making it more complex, I’m using more LED’s, a screen, a CdS light sensor, and a 74HC595 shift register. I have never used shift registers before. I needed to use one this time because of all the LED’s I was using, and all the extra knobs and whistles. This game has two options: 1) “Light-Stopper”; this game is like those games you find at an arcade where there is a huge plastic dome with lights in a circle, and you have to get the lights to stop on the one bulb closest to you (I think it’s called jackpot). 2) “Simon”; just like the memory-testing game, Simon. I am currently developing the “Light-Stopper” part, But I am having some problems. First off, here’s how this game works:
There are 7 LED’s, arranged in a horizontal line. In the middle is a RGB LED (so I guess you could say the total amount of LEDs is 9). One LED lights up at a time from left to right, and right to left (only one LED is on at any given time. To make i clearer, the pattern just looks like the light is getting ‘bounced’ back and forth, from right to left, and vice-versa). The shift register only controls the 3 LEDs on the left, and the 3 on the right. The middle RGB is controlled directly via 3 of the ATmega168’s digital pins (via PWM on pins 9, 10, & 11). Don’t worry about the four LEDs for the simon game now. There is a IR detector for input. When the user presses any button on a remote (just any IR remote from a TV, VCR, etc), it ‘stops’ the movement of the pattern (one LED is now lit, and stays lit). If they happen to get the timing right, and they stop the pattern when the middle RGB LED is lit, then they win. Pretty simple, but the programming is actually much more complicated with the shift register involved.
Lucky for me, there was sample code on the Arduino website on the 595 shift register. I implemented it into this project.
The problem is, it is acting erratically, and it doesn’t quite work. When it runs through the ‘light stopper’ sequence, after a while, the sequence stops, and some random LEDs light up. Also, when you stop the sequence on the middle LED, it keeps the LED next to the middle HIGH, and it does not go to the “Winner” subroutine. What’s wrong? Should I post a video of this problem? PLEASSEE help!! :’(