1 Attachment(s)
Displaying messages with only 7 (or 4) LEDs on a stick...
Hello,
I have trouble in making a stick with leds for displaying message like this example below (this picture is not mine: it was found in internet).
<img src=http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1627&stc=1&d=117907003 3">
Instead of 7 LEDs, I have only 4 to display letters; but it should work not too bad...
Currently, I have split one caracter into five sequences (or colons) and light them up for 3ms and then I wait 12ms before I repeat the same letter.
For test purposes, I repeat the same letter 50 times.
Does anyone have some example on how he did?
Thank you.
This is my actual code
Code:
' Fuses
@ DEVICE PIC16F690,FCMEN_OFF
@ DEVICE PIC16F690,IESO_OFF
@ DEVICE PIC16F690,BOD_OFF
@ DEVICE PIC16F690,CPD_OFF
@ DEVICE PIC16F690,PROTECT_OFF
@ DEVICE PIC16F690,MCLR_OFF
@ DEVICE PIC16F690,PWRT_OFF
@ DEVICE PIC16F690,WDT_OFF
@ DEVICE PIC16F690,INTRC_OSC_NOCLKOUT
'-------------------------------------------------------------------------------
' Registers
CM1CON0 = %00000000 'Comparator 1 is OFF
CM2CON0 = %00000000 'Comparator 2 is OFF
ANSEL = %00000000 'Disable analog inputs
ANSELH = %00000000 'Disable analog inputs
ADCON0 = %00000000 'ADC is OFF
OPTION_REG = %10000000 'Pull-Ups disabled...
TRISB = %00000000 'All PORTBs are Outputs
PORTB = %00000000 'All PORTBs are Low
WPUB = %00000000 'All Weak Pullups on PORTB are Bisabled
'-------------------------------------------------------------------------------
' Defines
'-------------------------------------------------------------------------------
' Variables
LED4 var PORTB.4
LED5 var PORTB.5
LED6 var PORTB.6
LED7 var PORTB.7
Counter_A var byte
LED_interval var byte
LED_interval = 3
Letter_interval var byte
Letter_interval = 12
'-------------------------------------------------------------------------------
' Program
LOOP:
for counter_a = 0 to 50
gosub letter_A
PORTB = 0
next
pause Letter_interval
for counter_a = 0 to 50
gosub letter_M
PORTB = 0
next
pause Letter_interval
for counter_a = 0 to 50
gosub letter_I
PORTB = 0
next
pause Letter_interval
goto loop
end
'-------------------------------------------------------------------------------
' Message
LETTER_A:
led4 = 0
led5 = 0
led6 = 1
led7 = 1
pause Led_interval
led4 = 1
led5 = 1
led6 = 1
led7 = 0
pause Led_interval
led4 = 1
led5 = 0
led6 = 1
led7 = 0
pause Led_interval
led4 = 1
led5 = 1
led6 = 1
led7 = 0
pause Led_interval
led4 = 0
led5 = 0
led6 = 1
led7 = 1
pause Led_interval
return
LETTER_M:
led4 = 1
led5 = 1
led6 = 1
led7 = 1
pause Led_interval
led4 = 0
led5 = 1
led6 = 0
led7 = 0
pause Led_interval
led4 = 0
led5 = 0
led6 = 1
led7 = 0
pause Led_interval
led4 = 0
led5 = 1
led6 = 0
led7 = 0
pause Led_interval
led4 = 1
led5 = 1
led6 = 1
led7 = 1
pause Led_interval
return
LETTER_I:
led4 = 1
led5 = 1
led6 = 1
led7 = 1
pause Led_interval
led4 = 1
led5 = 1
led6 = 1
led7 = 1
pause Led_interval
led4 = 1
led5 = 1
led6 = 1
led7 = 1
pause Led_interval
led4 = 1
led5 = 1
led6 = 1
led7 = 1
pause Led_interval
led4 = 1
led5 = 1
led6 = 1
led7 = 1
pause Led_interval
return
well then, how does it really work?
Yup ErnieM,
I was thinking about this "when to start to wave" problem.
This is also why I would have appreciated to get some code examples...
In all website (many thanks to MisterE 'cause I didn't know how to call this type of gadget before his post) where I could find information, there is no mention about a mouvement sensor in the case of handheld models.
My assumption was to repeat the message sequence endlessly and you modulate the wave speed to make it readable.
Or is it not that way it works?
So, if anybody else knows...