Created
April 9, 2012 19:57
-
-
Save oschettler/2346193 to your computer and use it in GitHub Desktop.
Sonnenbild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; Six charlieplexed LEDs on pins 1, 2, 4 | |
; Ambient brightness is measured through LED 6 | |
; | |
; pin1----+----+----------+---+ | |
; 1v 2^ 5v 6^ | |
; pin2----+----+--+---+ | | | |
; 3v 4^ | | | |
; pin4------------+---+---+---+ | |
; | |
; LED > 1 2 3 4 5 6 | |
; pin1 H L H L | |
; pin2 L H H L | |
; pin4 L H L H | |
; | |
#no_data | |
symbol brightness = w1 | |
symbol interval = w2 | |
symbol led = b1 | |
brightness = 1300 | |
do | |
for led = 0 to 5 | |
on led gosub l6, l4, l5, l2, l3, l1 | |
pause 30 | |
dirsC = %00000000 | |
; measure light on LED 6 by counting the time until a high-to-low transition occurs on pin4 | |
if led = 0 then | |
pulsin C.4, 0, brightness | |
endif | |
; sertxd ("Helligkeit: ", #w1, cr, lf) | |
pause 100 | |
next | |
interval = 1400 / brightness | |
pause interval | |
loop | |
l1: | |
high 1 | |
low 2 | |
return | |
l2: | |
low 1 | |
high 2 | |
return | |
l3: | |
high 2 | |
low 4 | |
return | |
l4: | |
low 2 | |
high 4 | |
return | |
l5: | |
high 1 | |
low 4 | |
return | |
l6: | |
low 1 | |
high 4 | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment