ultimo aggiornamento 2 marzo 2012


 

Per il collegamento del Modulo RGB alla Scheda BS2 SX occorre collegare la scheda e il modulo come riportato nello schema, si utilizzerà poi il programma allegato.

Per la prova servono:

homotix

Schema di collegamento

'
' Program: RGB LED Experiment #1
' Author: (c) 2007 by A Fox Consulting & Design
' http://www.afox-consulting.com
' Date: 10/29/2007
'
'
' {$STAMP BS2sx}
' {$PBASIC 2.5}

_LED_R PIN 0
_LED_G PIN 1
_LED_B PIN 2

' Color# B G R Name
' ------ - - - ------------
' Primary color pallette (I put white over in the pastels)
ColorSet DATA %111,%110 ' 2 0 0 2 Red
DATA %101,%110 ' 5 0 1 2 Orange
DATA %111,%100 ' 8 0 2 2 Yellow
DATA %110,%101 ' 7 0 2 1 Yellow/Green
DATA %111,%101 ' 6 0 1 0 Green
DATA %011,%101 ' 15 1 2 0 Blue/Green
DATA %111,%001 ' 24 2 2 0 Cyan
DATA %101,%011 ' 21 2 1 0 Aqua
DATA %111,%011 ' 18 2 0 0 Blue
DATA %110,%011 ' 19 2 0 1 Violet
DATA %111,%010 ' 20 2 0 2 Pink
DATA %011,%110 ' 11 1 0 2 Crimson
' Half-intensity color set (not too useful except for contrast)
HalfSet DATA %110,%111 ' 1 0 0 1 Dark Red
DATA %100,%111 ' 4 0 1 1 Olive
DATA %101,%111 ' 3 0 1 0 Dark Green
DATA %001,%111 ' 12 1 1 0 Dark Cyan
DATA %011,%111 ' 9 1 0 0 Dark Blue
DATA %010,%111 ' 10 1 0 1 Purple
DATA %000,%111 ' 13 1 1 1 Gray
' Pastel pallette (with blank to separate)
LightSet DATA %001,%110 ' 14 1 1 2 Light Red
DATA %011,%100 ' 17 1 2 2 Light Yellow
DATA %010,%101 ' 16 1 2 1 Light Green
DATA %110,%001 ' 25 2 2 1 Light Cyan
DATA %100,%011 ' 22 2 1 1 Light Blue
DATA %101,%010 ' 23 2 1 2 Light Pink
DATA %111,%000 ' 26 2 2 2 White
DATA %111,%111 ' 0 0 0 0 Black (off)

' ... and that's all 27 colors possible!

' Just a grouping of the different RGB intensities to compare
IntentSet DATA %110,%111 ' 1 0 0 1 Dark Red
DATA %111,%110 ' 2 0 0 2 Red
DATA %001,%110 ' 14 1 1 2 Light Red
DATA %111,%000 ' 26 2 2 2 White
DATA %101,%111 ' 3 0 1 0 Dark Green
DATA %111,%101 ' 6 0 1 0 Green
DATA %010,%101 ' 16 1 2 1 Light Green
DATA %111,%000 ' 26 2 2 2 White
DATA %011,%111 ' 9 1 0 0 Dark Blue
DATA %111,%011 ' 18 2 0 0 Blue
DATA %100,%011 ' 22 2 1 1 Light Blue
DATA %111,%000 ' 26 2 2 2 White
DATA %111,%111 ' 0 0 0 0 Black (off)

NumColors CON 40 ' Set to 39 to cycle through ALL entries
ColorPointer VAR Byte
i VAR Byte

DIR1 = 1
DIR2 = 1
OUT1 = 1
OUT2 = 1

Main:
FOR ColorPointer = 0 TO NumColors - 1
READ (ColorPointer*2), DIRA
READ (ColorPointer*2)+1, OUTA
PAUSE 500
NEXT
GOTO Main


Scarica il programma

Elenco revisioni
02//03/2012 Emissione preliminare
Private Policy Cookie Policy