Example 9: CBL 2 LED Display
This program is just for fun. It makes the CBL 2's lights blink on and off.
: For(M,1,10,1)
: For(N,1,3,1)
: Send({1998,N,1})
: End
: For(N,1,3,1)
: Send({1998,N,0})
: End
: End
Example 10: Playing Music on the CBL 2
This program plays "We Wish You a Merry Christmas."
:1500üK
:{2*K,2*K,K,K,K,K,2*K,
2*K,2*K,2*K,K,K,K,K,
2*K,2*K,2*K,2*K,K,K,K,K,
2*K,2*K,K,K,2*K,2*K,2*K,2*K}üL
:{182,136,136,121,136,144,162,
162,162,121,121,108,121,136,
144,182,182,108,108,102,108,121,
136,162,182,182,162,121,144,136}üL
:For(N,1,30,1)
:Send({1999,L
(N),L
1
:End
Example 11: Command 8 Program
This is a program to receive data points while sampling.
:Send({0})
:Send({1,1,1})
:Send({3,.2,100,0})
:For(N,1,80,1)
:Send({8,1,0})
:Get(L
)
2
:Disp L
2
:End
:Get(L
)
1
52
Repeat 10 times to make the lights flicker on and off.
Turn all three lights on.
Turn all three lights off.
1
2
(N)})
2
Clear sampling settings.
Set up Channel 1 with auto-ID.
Take 100 samples in 20 seconds.
Use a loop to get samples as they are taken.
Ask for Channel 1's last sampled data point.
Get the sensor type, most recent data point, and position in resulting list.
Display the three-element list to the screen.
Get the resulting list of data.
K = 0.15 second
Play the short notes for 0.15 seconds and the long ones
for 0.3 seconds.
Enter each note value in the list.
Send each time and note to the CBL2 so that it can play
every note in the order of the lists.
CBL 2 Technical Reference