/** @page controlling_led_grids Controlling LED grids @section basic_usage Basic usage An LED grid on a BLOCKS device can be controlled via an LEDGrid object, which can be obtained from the Block::getLEDGrid function of a Block---see the @ref discovering_blocks section for details of how to obtain a %Block object. Using an LED grid requires an LEDGrid::Program to operate the LEDs. This program specifies some code to run on the device, and can also provide methods to be called from your application which can comminucate with the code running on the device via a block of shared memory. The code which runs on the device must be specified using @ref the_littlefoot_language, which is described in the corresponding section. However, for a very wide range of applications, the BitmapLEDProgram provided with the BLOCKS SDK is sufficient and you will not need to create your own. Using a %BitmapLEDProgram to change the colour of LEDs is demonstated below. @code{.cpp} // This should be called when doing the initial configuration of your application. void setBitmapLEDProgram (Block& block) { if (auto grid = block->getLEDGrid()) grid->setProgram (new BitmapLEDProgram (*grid)); } // Once a BitmapLEDProgram is loaded we can use its setLED method to change the // colour of LEDs on the corresponding device. void setLED (Block& block, int x, int y, Colour c) { if (auto grid = block->getLEDGrid()) if (auto program = dynamic_cast (grid->getProgram())) program->setLED (x, y, c); } @endcode @section advanced_usage Advanced Usage Using a custom %LEDGrid::Program allows more precise control over the operation of the LEDs. The code which will actually execute on the device, returned by your overriden LEDGrid::Program::getLittleFootProgram() function, must be specified in the LittleFoot language. @subsection the_littlefoot_language The LittleFoot Language A description of the LittleFoot language is contained in the SDK source code at juce_blocks_basics/littlefoot/LittleFoot Language README.txt: @includedoc "LittleFoot Language README.txt" @subsection littlefoot_example A LittleFoot example The %BitmapLEDProgram class is a simple example of a LittleFoot program. %juce_blocks_basics/visualisers/juce_BitmapLEDProgram.h @include juce_blocks_basics/visualisers/juce_BitmapLEDProgram.h juce_blocks_basics/visualisers/juce_BitmapLEDProgram.cpp @include juce_blocks_basics/visualisers/juce_BitmapLEDProgram.cpp The repaint() method of the LittleFoot program is called at approximately 25 Hz, and each time it simply inspects the heap (the shared area of memory used to communicate between your application code and your LittleFoot program) and sets the LEDs based on the heap's content. To update the heap, and hence the LEDS, your application code calls BitmapLEDProgram::setLED. A more advanced example can be found in the source code of the DrumPadGridProgram class. */