LED light display - simple beginner project for 08M2

MaryT

New Member
Hi Everyone,
This is my first attempt at programming the Picaxe 08M2. Okay, really it's my second - I had to try out the 'tune' command first! It might be a fun circuit for kids or beginners.

Code:
' Light display for a string of 8 red LEDs for 08M2
'connect led1 and 8 in series thru a 330 ohm resistor to output 0 (anode), cathode to gnd
'similarly connect 2 and 7 in series to output 1,  3 and 6 to output 2, and 4 and 5 to output 4

loop1:	for b0 = 1 to 5
			high 0		' flash outermost leds
			pause 200
			low 0
			high 1		' flash next 2 leds
			pause 200
			low 1
			high 2		'flash next 2 leds
			pause 200
			low 2
			high 4		'flash innermost 2 leds
			pause 200
			low 4
			high 2		'go back out with pattern
			pause 200
			low 2
			high 1
			pause 200
			low 1
		next b0
			
			high 0
			pause 200
			low 0
			
loop2:	for b1 = 1 to 3
			high 0
			high 1
			high 2
			high 4		' flash all 8 leds together
			pause 200
			low 0
			low 1
			low 2
			low 4
			pause 200
		next b1
		
			goto loop1
 

Attachments

Top