Picaxe Manual 3, page 9 shows a method to control a bi-color LED using 2 Picaxe pins. I have a project where I control a bi-color LED (red/green/off) using a single pin. With this set-up, the pin draws these currents (red: 2.6 mA...green: 4.3 mA...OFF: mA) as measured with my meter.
Code:
'**************************************
'* Use a single Picaxe pin to control a
'* bi-color R/G LED (Red/Green/OFF).
'**************************************
; 18M2
;+--------+
;| | 2 pin RG LED
'| | +--------+
'| | |<R LED |----|---100 ohm---+5
'| C.1 |Pin 18 --------------| |
'| | |G LED> |----|---100 ohm---gnd
'+---------+ +---------+
#picaxe 18m2
symbol RGled = C.1 'pin 18.
#macro RGled_green
high C.1
#endmacro
#macro RGled_red
low C.1
#endmacro
#macro RGled_off 'Makes B.7 an input & turns led off.
reverse C.1
#endmacro
Init:
pause 500 'Pause to initialize system.
Main:
do
RGled_green
pause 5000
RGled_red
pause 5000
RGled_off
pause 5000
loop