LED S404

![]() | ![]() | ![]() | ![]() |
LED seven segment, 4 digit display
- Overview
- Drivers
- Samples
- Projects
LED S404

Two types available: Count or Time formatted.
Key features • 4 Digit 7 segment LEDs | Resources |
Function | Description |
---|---|
Init() | Init driver. Called when system boot |
DVer() | This driver version. |
Digit(number) | Draw number to led. n: number |
Dot(index, v) | Draw dot at index, v: 0: off, 1: on |
Colon(n) | Show colon. |
The Code!
Modules ship with this script preloaded. Use Console to reload or modify the drivers. Additionally, some languages, such as Python, include DUELink.Engine.Record()
for recording scripts directly from the host.
##### Driver Code Starts Here ###
fn Init()
dim a1[13] = {1,1,2,3,4,5,6,7,8,9,10,11,12} # common pin, first 8 for data, second 4 for scan
gfxcfg(4, a1, 8, 4, 1)# type 4: 7seg (8 leds) x 4 digits, 1: buffered x1
Clear(0)
Show()
fend
fn Seg7(i, s)
if i > 3
return
end
if s > 9
return
end
i = 3 - i
if s = 0
Pixel(1,0,i)
Pixel(1,1,i)
Pixel(1,2,i)
Pixel(1,3,i)
Pixel(1,4,i)
Pixel(1,5,i)
Pixel(0,6,i)
end
if s = 1
Pixel(0,0,i)
Pixel(1,1,i)
Pixel(1,2,i)
Pixel(0,3,i)
Pixel(0,4,i)
Pixel(0,5,i)
Pixel(0,6,i)
end
if s = 2
Pixel(1,0,i)
Pixel(1,1,i)
Pixel(0,2,i)
Pixel(1,3,i)
Pixel(1,4,i)
Pixel(0,5,i)
Pixel(1,6,i)
end
if s = 3
Pixel(1,0,i)
Pixel(1,1,i)
Pixel(1,2,i)
Pixel(1,3,i)
Pixel(0,4,i)
Pixel(0,5,i)
Pixel(1,6,i)
end
if s = 4
Pixel(0,0,i)
Pixel(1,1,i)
Pixel(1,2,i)
Pixel(0,3,i)
Pixel(0,4,i)
Pixel(1,5,i)
Pixel(1,6,i)
end
if s = 5
Pixel(1,0,i)
Pixel(0,1,i)
Pixel(1,2,i)
Pixel(1,3,i)
Pixel(0,4,i)
Pixel(1,5,i)
Pixel(1,6,i)
end
if s = 6
Pixel(1,0,i)
Pixel(0,1,i)
Pixel(1,2,i)
Pixel(1,3,i)
Pixel(1,4,i)
Pixel(1,5,i)
Pixel(1,6,i)
end
if s = 7
Pixel(1,0,i)
Pixel(1,1,i)
Pixel(1,2,i)
Pixel(0,3,i)
Pixel(0,4,i)
Pixel(0,5,i)
Pixel(0,6,i)
end
if s = 8
Pixel(1,0,i)
Pixel(1,1,i)
Pixel(1,2,i)
Pixel(1,3,i)
Pixel(1,4,i)
Pixel(1,5,i)
Pixel(1,6,i)
end
if s = 9
Pixel(1,0,i)
Pixel(1,1,i)
Pixel(1,2,i)
Pixel(0,3,i)
Pixel(0,4,i)
Pixel(1,5,i)
Pixel(1,6,i)
end
fend
fn Dot(i, v)
Pixel(v,16,i)
fend
fn Colon(v)
Pixel(v,7,1)
fend
fn Digit(n)
seg7(0,n%10)
seg7(1,(n/10)%10)
seg7(2,(n/100)%10)
seg7(3,(n/1000)%10)
fend
fn DVer()
return 0.1
fend
Init()
##### User Code Starts Here #####
- Script
- Python
- JavaScript
Use Console to modify the default driver by adding this sample.
# Append this code at the bottom of the script, right after the driver.
# You MUST keep the driver code!!
_x=0
while 1
Digit(_x)
Show()
_x=_x+1
wait(1000)
wend
from DUELink.DUELinkController import DUELinkController
import time
availablePort = DUELinkController.GetConnectionPort()
duelink = DUELinkController(availablePort)
//code
Coming soon!
Ordering Info
Description | Part Number | Price |
---|---|---|
LED S404-Count | GDL-LLEDS404C-A | $00.00 |
LED S404-Time | GDL-LLEDS404T-A | $00.00 |