The authentic way to do the "KITT" display is to show LEDs moving back and forth by turning a "main" LED on full bright and surround that full bright LED with progressively dimmer LEDs. That is not that hard to do using the PWM (Pulse Width Modulation) features of the PICAXE, but I thought there may be an easier way.
I wanted to test a simpler way to simulate the display on "KITT" by just turning the LEDs on/off in sequence quickly. I was also interested in experimenting with the PICAXE "let dir", "let pins", and "lookup" and this seemed like an easy platform to do this. In the first attempt a PICAXE 18M2 was used to simulate an eight LED "KITT" display. The result was surprisingly excellent. To me, the PWM is not really needed due to the persistence for your vision and the LEDs. An ADC input on the PICAXE was used to allow for an adjustable delay on how fast the display moves. Here is a short video of the results:
The original forum question was asked by Jacob2803. He gave it a try with my code as well and here is a short youtube video of his nice result: http://www.youtube.com/watch?v=HwoHKqRI-sY
-----
After seeing an eight LED Chaser display the discussion of using more LEDs came up. More is always better, right?. The PICAXE forum is an interesting place. It has participation of users from all levels; beginner to expert, and the brainstorming of solutions (on many problems) can be inspiring. Many options were provided on increasing the LED count. My thought on increasing the count on the LED Chaser display was to use the PICAXE 08M2 and the 74154 (4:16 Decoder). The PICAXE 08M2 has fewer outputs than the 18M2 that was used above, but the 74154 only needs four control signals to turn on any one of 16 LEDs at a time.
Here is a picture and short video of what the 16 LED Chaser looked like on the development board:
The 16 LED Chaser looked so cool, I decided to move it to a PCB and keep it "forever". It barely looks like it has any similarity to the development board build. Since the circuit is very minimal it cleans up well on the PCB.
-----
I programmed a few different chaser patterns into the PICAXE that can be selected with a button press. Here is a short video of the PCB version of the 16 LED Chaser in action.
My code and schematic is below in case you want to build your own. If you build it and mount it to a 1982 Pontiac Trans Am please send us a pic. ;)
Schematic:
PICAXE Code:
#rem
*******************************
***** www.WhiskyTangHotel.Com *****
*******************************
Project Name: 16 LED Chaser with 08M2 and 74590 Decoder
Start Date: May 18, 2012
*******************************
PICAXE PE Rev: MacAXEPad 1.3.2
#endrem
#picaxe08m2
let dirsC = %11110111
'b0 is used as a general loop counter
Symbol StepDelay = b1
Symbol WhatCase = b2
Symbol MaxCases = b3 'Init value set below. The # of possible display cases select routines programmed
'w2 (b4 and b5) used in random LED Case Select
Symbol ButtonPush = pinC.3
'Initialize some values
StepDelay = 20 ' Time to keep the only sigle LED the 74590 can turn on until moving to the next LED
Whatcase = 4 'Case Select routine that 'kicks things off' after reset
MaxCases = 4 '# of possible display cases select routines programmed.
main:
if ButtonPush = 1 then 'jump to a different Case Select routine
pause 25
Do While ButtonPush = 1
pause 25
loop
pause 25
if WhatCase = MaxCases then
let WhatCase = 0 ' reset WhatCase if it is equal the # of possible display cases programmed
endif
WhatCase = WhatCase + 1
endif
Select Case WhatCase
Case 1 'LEDs scan up and repeat
gosub LEDsUp
Case 2 'LEDs scan down and repeat
gosub LEDsDown
Case 3 'LEDs scan up the down and repeat. This simulates the display on the "KITT" car in KnightRider
gosub LEDsUp
gosub LEDsDown
Case 4 'randomly turn on one LED at a time
gosub LEDRandom
end select
goto main
'LED pattern subroutines here. Of course, more case routines can be added.
LEDsDown:
for b0 = 0 to 7
let pinsC = b0
pause StepDelay
next b0
'jump to 16 to turn on bit position 5
for b0 = 16 to 23
let pinsC = b0
pause StepDelay
next b0
return 'LEDsDown
LEDsUp:
for b0 = 23 to 16 step -1
let pinsC = b0
pause StepDelay
next b0
for b0 = 7 to 0 step -1
let pinsC = b0
pause StepDelay
next b0
return 'LEDsUp
LEDRandom:
RANDOM w2
let pinsC = w2 // 23 + 1 '"//" is modulus divide (returns remainder)
return 'LEDRandom
-----