My circuit is currently:
TEENSY 2.0 to RESISTOR to LED to GROUND
Im trying to make it so that if green led = flash once, if yellow = flash twice, if red, flash 3 times
How would I do this? Is there a function call to make the Teensy board recognize the LED's? Or the Resistance?
You might be able to do this by attempting to read the LED voltage using an ADC, but that may not tell you anything because LEDs are made using various chemistries. The only reliable way to do this would be to use a color sensor chip and aim it at the LED. You'll find that to be a much more expensive and complicated project.
You could read the voltage between the resistor and the LED.
That would tell you the difference between red and green, detecting other colors might be difficult.
Each wavelength / band gap - has a certain forward voltage drop, so that's what you'd be measuring... curious project I might have a play see what results i get...
Let's say Im using these LED's
How would I write that in Arduino?
wow, i've not seen one of them since 1988 lol, age 7 at the top of the stairs my dad gave me a 9v battery and an LED, thinking back the 9v battery was pretty dead (he got me to taste it, very very mild) but yeah i connected the LED both ways until it lit up glowed almost changing color (obviously, too much voltage) but as the battery went dead , the LED was this type!
use a 300 ohm resistor in series to keep the current down on these old things...
oh yeah, you meant reading the voltage duh…
hook one up and measure the voltage…