New to BS2; a few simple questions...
mikeycp15
Posts: 1
I'm fairly new to the Basic Stamp and am currently finishing up the "What's a Microncontroller?" book with the BS2 mounted on the Basic Stamp Homework Board.· I've just started working on some projects of my own and have run into some problems with PBASIC programming trying to get my project to do what I want.· I have built a simple photoresistor with a 7-segment digital display and successfully programmed them so that the digital display shows a number 0 - 9 depending on how much light there is ( 0 = very little light, 9 = very bright).· I am now trying to get a green LED to flash while the program is running, 2 seconds on, half a second off, repeatedly.· The problem is that when the LED is pausing for 2 seconds on and then half a second off, the photoresistor and digital display parts of the program are not running and therefore no change on the display occurs until the split second when that part of the program is run through again.· I then have to wait another 2 and a half seconds.· Is there any way I can have the LED flash independently of the main part of the program??
Second part:· I would also like my piezoelectric speaker to beep when ever there is change in the digital display (a change in the amount of light).· I believe I have to·program something·like:
IF (???) THEN
FREQOUT 0, 500, 1500
However, I think I need to add counter or something so the program knows it a refering to a comparison with the last time through the loop.· Also, the counter would need to be 1 TO infinetly for an continuous loop, but I don't know how to represent this.· Lastly, I think this would also have the problem of the previous question: when the beep is playing for the half second, no photoresistor reading is being taken.
I've attached what I have so far.· Any and all help is greatly appriated.· Thanks, Mike
Second part:· I would also like my piezoelectric speaker to beep when ever there is change in the digital display (a change in the amount of light).· I believe I have to·program something·like:
IF (???) THEN
FREQOUT 0, 500, 1500
However, I think I need to add counter or something so the program knows it a refering to a comparison with the last time through the loop.· Also, the counter would need to be 1 TO infinetly for an continuous loop, but I don't know how to represent this.· Lastly, I think this would also have the problem of the previous question: when the beep is playing for the half second, no photoresistor reading is being taken.
I've attached what I have so far.· Any and all help is greatly appriated.· Thanks, Mike
Comments
Yes, but only with an external flashing circuit: a Stamp output pulse would trigger a one-shot which would enable a gated oscillator.