To drive this I need a microcontroller, at first I thought of a PIC16F648a but I only had one and that packed up, so I ended up with a PIC16F688. I can't program in C or C++ never got used to the syntax, so I'm using BASIC to program the chip with a rather now dated Oshonsoft still pretty good for the smaller chips. Anyhow all you need next are 4x 10mm green LED's and a rotary encoder. I will include a circuit and a HEX dump at some point but can't be arsed at mo as its beer o'clock..
Here'e the complete Code, which includes the font. Uses 65% of chip memory..
'16F688 14pin IC running at 8mhz internal clock '18th April 2018 'Code to make a Rick Sanchez Portal Gun
AllDigital Define STRING_MAX_LENGTH = 20 OSCCON = %01110110 TRISA = %00000111 TRISC = 0 PIE1 = 0 OPTION.7 = 0 'Weak pullup on, need these for the rotary encoder..
OPTION.6 = 0 Symbol scl = PORTC.3 'PIN 7 Symbol sda = PORTC.4 'PIN 6 Symbol front1 = PORTC.2 'Front LED's Symbol front2 = PORTC.1 Symbol front3 = PORTC.0 Symbol bulb = PORTA.5 ' TOP LED for bulb
bulb = 0
'dimm = 1 Dim fnt As Word Dim fnt1 As Word Dim temp As Word Dim temp1 As Byte Dim flag As Bit Dim text As String 'Dim dump As Word Dim world As Word Dim world_realm As Byte
world_realm = 67 'Letter C world = 137 'Huh 137 earth
PORTC = 0
WaitMs 50
I2CPrepare sda, scl Call front(0) ' Turns off all the front LED's bulb = 0 ' Turns off the top bulb LED
text = "RicK" Call display(text, 1) WaitMs 3000 Break text = Chr(world_realm) If world < 100 And world > 9 Then text = text + "0" If world < 10 Then text = text + "00" text = text + #world
Call display(text, 1)
WaitMs 3000
If world = 138 Then bulb = 1 For temp = 1 To 100 Call front(1) WaitMs 10 Call front(0) WaitMs 50 Next temp Else Call front(0) bulb = 0 Endif
Goto loop '############################################################ End
Proc front(arg As Bit) front1 = arg front2 = arg front3 = arg End Proc
On Interrupt Save System INTCON.INTF = 0 INTCON.RAIF = 0 INTCON = 0
text = Chr(world_realm) If world < 100 And world > 10 Then text = text + "0" If world < 10 Then text = text + "00" text = text + #world
Call display(text, 0)
While RA0 = 1 And RA1 = 1 And RA2 = 1 Wend
If RA0 = 0 And RA1 = 1 Then world = world - 1 If world = 65535 Then world = 999 world_realm = world_realm - 1 If world_realm < 65 Then world_realm = 90 Endif While RA0 = 0 And RA1 = 1 Wend Endif
If RA0 = 1 And RA1 = 0 Then world = world + 1 If world > 1000 Then world = 0 world_realm = world_realm + 1 If world_realm > 90 Then world_realm = 65 Endif While RA1 = 0 And RA0 = 1 Wend Endif