So I have the I/O expander running an LED on every output but they all are dim (like 25%) compared to plugging the LED (and its resistor) straight into the 5V source. I checked the expanders outputs and it's putting out 5V but it sure isn't acting like it. Anyone know what I'm doing wrong?
I have a viddy I took of the situation but it's taking forever to U/L. I'm hoping this problem is something "duh" that doesn't require visuals but I got it coming just in case.
edit- Grog asked so I thought I'd add that the chip can output 100mA. Small detail that might be a question for others. Also when I use a 5V LED (the ones with built-in resistors) it is also super dim. Hmm...
edit #2- found there is only 0.11mA being output on the pins. I have no idea why. Therein lies my new question, dear reader.
Successful code excised from my main program:
-------------------------------
symbol seed = w5 'seed for random number generator; = TIMER SFR
symbol rndnmbr = w6 'led
symbol sprout = w7 'led
symbol leds = b20 '%00000000 LED n
symbol LED_decimal = b12 'first byte from rndnmbr
symbol LED_bcd = b24
rndnmbr = 3
HI2CSETUP I2CMASTER, %01110000, i2cfast, i2cbyte 'set for I/O expander I2C
Alert:
for b1 = 1 to 10
hi2cout 0, (%11111100) 'red and blue siren effect
pause 250
hi2cout 0, (%11001111)
pause 250
next b1
locked:
{
for b1 = 1 to 100
LEDs = 254
call rand_led
'debug
if LED_bcd = %11111111 then goto locked 'always random colored lighting, never all LEDs off
hi2cout 0, (LED_bcd)
LEDs = 3500 'maximum delay time
DO
call rand_num
'debug
LOOP until rndnmbr <= LEDs 'AND rndnmbr > 250
pause rndnmbr
next b1
looking:
for b1 = 1 to 3
{
hi2cout 0, (%11111100) 'red
pause 650
hi2cout 0, (%11111111)
pause 300
hi2cout 0, (%00111111) 'yellow
pause 650
hi2cout 0, (%11111111)
pause 300
hi2cout 0, (%11110011) 'blue
pause 650
hi2cout 0, (%11111111)
pause 300
hi2cout 0, (%00111111) 'yellow
pause 650
hi2cout 0, (%11111111)
pause 300
}
next b1
goto alert
rand_led:
{
'DO
seed = time
RANDOM seed
rndnmbr = seed // leds '- 1
'LOOP UNTIL sprout <> rndnmbr
LED_bcd = LED_decimal / 10 * 16 'convert first byte from RNDNMBR word var to BCD byte for IO expander
LED_bcd = LED_decimal // 10 | LED_bcd
return
}
rand_num:
{
'DO
seed = time + 250
RANDOM seed
rndnmbr = seed // leds + 1
'LOOP UNTIL sprout <> rndnmbr
LED_bcd = LED_decimal / 10 * 16 'convert first byte from RNDNMBR word var to BCD byte for IO expander
LED_bcd = LED_decimal // 10 | LED_bcd
return
}}