Hub の内蔵光センサーを使う


 
An optical sensor is located on the side of TI-Innovator Hub.

Define brightness()=
Prgm
:   Local i,b,level
:
:   While getKey()≠"esc"
:      Send "READ BRIGHTNESS": Get b
:      level:="∣"
:      For i,1,((b)/(4.))
:         level:=level&"∎"
:      EndFor
:      Disp level,format(b,"f1")
:      Wait 0.1
:   EndWhile
:
:EndPrgm