Stop The Blinking!
kivimaki
Posts: 2
I am doing an art project with a basic stamp and an accelerometer where a light gets brighter the longer the object is in motion. If the object is at rest, the light slowly fades away.
I finally got everything to work (at the beginning of the project three weeks ago I had never used a basic stamp and had no experience with circuitry), but the light is constantly blinking.
To make the light (flashlight bulb) fade, I have it hooked up to a transistor and I am using PULSOUT with a variable duration on the base. I believe that the blinking is introduced when the stamp gets the info from the accelerometer, because my PULSOUT method works in a simple DO ... LOOP.
Is there any way to fix the blinking but maintain the fading effect? I thought about using a digital potentiometer, but when I tried it out, it didn't work.
Any suggestions would be greatly appreciated.
I finally got everything to work (at the beginning of the project three weeks ago I had never used a basic stamp and had no experience with circuitry), but the light is constantly blinking.
To make the light (flashlight bulb) fade, I have it hooked up to a transistor and I am using PULSOUT with a variable duration on the base. I believe that the blinking is introduced when the stamp gets the info from the accelerometer, because my PULSOUT method works in a simple DO ... LOOP.
Is there any way to fix the blinking but maintain the fading effect? I thought about using a digital potentiometer, but when I tried it out, it didn't work.
Any suggestions would be greatly appreciated.
Comments
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
Gee. Why don't you post your code? There are a LOT of helpful people here that may be able to spot the problem in your code. Maybe, even me, although I am also a newbie.
Just for curiosities' sake, why did you use a flashlight bulb instead of an LED? (Not that your choice is "wrong"; it just seems more difficult to me, although it may not be.)
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Well, you can do something similar in code, using:
OnCounter VAR BYTE
BlinkState VAR BIT
LightBulb CON 0 ' 0 being the pin the lightbulb control is on in this example
BlinkState = 0
OnCounter = 0
MAIN:
IF BlinkState = 0 THEN
BlinkState = 1
HIGH LightBulb
ELSE
BlickState = 0 ' it WAS 1 on entry...
LOW LightBulb
END IF
IF SensorTime THEN
ReadSensor
ELSE
PauseOneSensorTime
ENDIF
' When HERE, go do something else, like read your sensor.
' Note, you'll have to experiment to find out how long it takes
' to read your sensor.
The idea with this code (bad example, sorry about that) is to use the time around the main loop of your program as a primitive time-delay. It's going to be around 20 mSec or so -- which would give you a slow but effective 'PWM rate'.
So, a 50% duty cycle would be 20 mSec on, 20 mSec off. Your eye can't react this fast, so you won't see any flicker. To change the duty cycle, use the "OnCounter" to adjust how many cycles the light is 'on' versus 'off'.