<rdf:RDF
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xml:base='http://www.loadbang.net/rdf'>
    <s:Snip rdf:about='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Tutorials/First+Light'
         s:cUser='nick'
         s:oUser='nick'
         s:mUser='nick'>
        <s:name>Software/net.loadbang.shado/Tutorials/First Light</s:name>
        <s:content>This is hopefully where things start to get interesting. This is a script which, when loaded, turns on all the LEDs. (More correctly, it illuminates an eight-by-eight block of LEDs, regardless of monome size.)&#xD;&#xA;&#xD;&#xA;The main body of the script looks like this:&#xD;&#xA;&#xD;&#xA;{code:python}&#xD;&#xA;lightBlock = Block(8, 8)&#xD;&#xA;lightBlock.fill(LampState.ON)&#xD;&#xA;renderer.render(lightBlock)&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;When this runs, the LEDs will come on. In fact, they&apos;ll stay on even when other scripts are loaded, so this script is slightly antisocial; we&apos;ll deal with cleaning up script actions later.&#xD;&#xA;&#xD;&#xA;We&apos;ll look at the statements in order:&#xD;&#xA;&#xD;&#xA;{code:python}&#xD;&#xA;lightBlock = Block(8, 8)&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;This creates an object called ~~lightBlock~~ which is a ~~shado~~ ~~Block~~: a rectangular matrix of lamp settings. To light up the monome&apos;s LEDs, we need to set these lamps to an &quot;on&quot; state:&#xD;&#xA;&#xD;&#xA;{code:python}&#xD;&#xA;lightBlock.fill(LampState.ON)&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;This isn&apos;t quite enough to actually light the LEDs. To do that, we need to ~~render~~ the Block out to the monome itself.&#xD;&#xA;&#xD;&#xA;{code:python}&#xD;&#xA;renderer.render(lightBlock)&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Before these statements will work we need to do some book-keeping. Names like ~~Block~~, ~~LampState~~ and ~~renderer~~ need to be imported into the script so that the Python system knows where to find them. The import statements look like this:&#xD;&#xA;&#xD;&#xA;{code:python}&#xD;&#xA;from net.loadbang.shado import Block&#xD;&#xA;from net.loadbang.shado.types import LampState&#xD;&#xA;from config import renderer&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;The first two statements (those mentioning ~~net.loadbang.shado~~) refer to components inside the ~~shado~~ package. The third statement is actually referring to another file of Python statements (called ~~config.py~~), which does some local configuration such as establishing communication settings for the monome.&#xD;&#xA;&#xD;&#xA;Before the script runs:&#xD;&#xA;&#xD;&#xA;{image:img=off.png}&#xD;&#xA;&#xD;&#xA;After the script runs:&#xD;&#xA;&#xD;&#xA;{image:img=on.png}&#xD;&#xA;&#xD;&#xA;1 Full Script&#xD;&#xA;&#xD;&#xA;{code:python}&#xD;&#xA;&apos;&apos;&apos;&#xD;&#xA;When launched, this script turns on all LEDs.&#xD;&#xA;&apos;&apos;&apos;&#xD;&#xA;&#xD;&#xA;from net.loadbang.shado import Block&#xD;&#xA;from net.loadbang.shado.types import LampState&#xD;&#xA;from config import renderer&#xD;&#xA;&#xD;&#xA;lightBlock = Block(8, 8)&#xD;&#xA;lightBlock.fill(LampState.ON)&#xD;&#xA;renderer.render(lightBlock)&#xD;&#xA;{code}&#xD;&#xA;</s:content>
        <s:mTime>2009-03-01 21:09:13.639</s:mTime>
        <s:cTime>2009-03-01 20:52:26.298</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Tutorials'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Workbench'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Tutorials/Buttons'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.jython'/>
                <rdf:li>
                    <s:Snip rdf:about='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Tutorials/First+Light'>
                        <s:attachments>
                            <rdf:Bag>
                                <rdf:li>
                                    <s:Attachment rdf:about='http://www.loadbang.net/space/Software/net.loadbang.shado/Tutorials/First+Light/off.png'
                                         s:fileName='off.png'
                                         s:contentType='image/png'
                                         s:size='1368'>
                                        <s:date>Sun Mar 01 21:09:05 UTC 2009</s:date>
                                    </s:Attachment>
                                </rdf:li>
                                <rdf:li>
                                    <s:Attachment rdf:about='http://www.loadbang.net/space/Software/net.loadbang.shado/Tutorials/First+Light/on.png'
                                         s:fileName='on.png'
                                         s:contentType='image/png'
                                         s:size='1423'>
                                        <s:date>Sun Mar 01 21:09:13 UTC 2009</s:date>
                                    </s:Attachment>
                                </rdf:li>
                            </rdf:Bag>
                        </s:attachments>
                    </s:Snip>
                </rdf:li>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/Nixies'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Tutorials/Hello World'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.fireflash'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/TextBrick'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.web'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#SnipSnap/config'/>
                <rdf:li rdf:resource='#Software'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Tutorials/Quick Tour'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado/README'/>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#start/2009-02-03/1'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang-SQL'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang-lib'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Tutorials/'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.groovy'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang-SQL/MySQL'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/net.loadbang.shado/Tutorials/The Demos'/>
                <rdf:li rdf:resource='http://www.loadbang.net/rdf#Software/Registry'/>
                <rdf:li rdf:resource='#snipsnap-notfound'/>
            </rdf:Bag>
        </s:snipLinks>
    </s:Snip>
</rdf:RDF>
