Jump to content

Using the simulator indicator lamps

From Sandbox Pedal Wiki

The simulator's Indicators section has two lamps, LED1 and LED2, which follow the registers REG30 and REG31 as your program runs. They give you a way to see a value you cannot hear while you are developing — an envelope follower, a tempo, the state of a switch.

How brightness is worked out[edit | edit source]

The lamp reads its register as S1.23:

  • 0 is off.
  • 1.0 is full brightness.
  • A negative value is off. It is not rectified, so a bipolar signal lights the lamp only
 on its positive half.

The scale is linear on purpose. A program that wants a curve is two instructions from the curve it wants.

The FV-1 has no LEDs. The lamps exist in the simulator only — nothing lights up on the pedal when your program writes to REG30 or REG31. They are a debugging aid for the time you spend writing code, not an output you can ship. A design that needs an indicator on the finished pedal needs one built into the hardware.

Lighting a lamp[edit | edit source]

Write the value you want to see into REG30 or REG31:

; #LED1 Rate

skp     run, loop
wlds    sin0, 12, 32767

loop:
cho     rdal, sin0      ; bipolar, -1 to +1
sof     0.5, 0.5        ; fold to 0..1 so the lamp follows the whole cycle
wrax    reg30, 0

Without the sof 0.5, 0.5 the lamp is dark for half of every LFO cycle.

Naming the lamps[edit | edit source]

A comment tag renames a lamp in the panel:

; #LED1 Tempo

The tag is read from the comment part of the line, so it never collides with code. It is the same mechanism that names the pots — see Labelling pots and lamps in your source.

A gotcha[edit | edit source]

Nothing on the FV-1 reserves REG30 or REG31. A program that parks scratch values there will light the lamps by accident. If a lamp flickers for no reason you can explain, check whether those two registers are being used as general-purpose storage.

See also[edit | edit source]