<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Psychic Origami &#187; chumby</title>
	<atom:link href="http://www.psychicorigami.com/category/chumby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.psychicorigami.com</link>
	<description>folding with my brain</description>
	<lastBuildDate>Sat, 17 Jul 2010 09:15:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Chumby to Arduino communication using PySerial</title>
		<link>http://www.psychicorigami.com/2010/06/26/chumby-to-arduino-communication-using-pyserial/</link>
		<comments>http://www.psychicorigami.com/2010/06/26/chumby-to-arduino-communication-using-pyserial/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 20:52:03 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[chumby]]></category>

		<guid isPermaLink="false">http://www.psychicorigami.com/?p=278</guid>
		<description><![CDATA[So here are a few notes on getting a Chumby to talk to an Arduino using PySerial (and Python). It&#8217;s pretty easy, but I&#8217;ll document it to make it obvious. As the Chumby is sometimes a bit slow with a few of these steps, it&#8217;s good to know it will work in the end. First [...]]]></description>
			<content:encoded><![CDATA[<p>So here are a few notes on getting a <a href="http://www.chumby.com/">Chumby</a> to talk to an <a href="http://www.arduino.cc/">Arduino</a> using <a href="http://pyserial.sourceforge.net/">PySerial</a> (and <a href="http://www.python.org/">Python</a>).  It&#8217;s pretty easy, but I&#8217;ll document it to make it obvious.  As the Chumby is sometimes a bit slow with a few of these steps, it&#8217;s good to know it will work in the end.</p>
<p>First you&#8217;ll want <a href="http://wiki.chumby.com/mediawiki/index.php/Python">Python on the Chumby</a>.  At the time the latest version already compiled for the Chumby is Python 2.6, so it&#8217;s pretty up-to-date.</p>
<p>Once you&#8217;ve got Python installed and on a USB stick you&#8217;ll also want to download PySerial &#8211; I picked the latest version <a href="http://sourceforge.net/projects/pyserial/files/pyserial/2.5-rc2/pyserial-2.5-rc2.tar.gz/download">PySerial-2.5-rc2</a>.</p>
<p>With PySerial expanded and on the USB stick (alongside Python) you&#8217;ll want to put the USB stick in the Chumby and connect to it <a href="http://wiki.chumby.com/mediawiki/index.php/Chumby_tricks#Hidden_screen_in_Control_Panel">via SSH</a>.</p>
<p>Change to the directory for the USB stick (e.g. <code>cd /mnt/usb</code>).</p>
<p>You should see (at least) two directories, one for Python and one for PySerial:</p>
<pre>
<code>
chumby:/mnt/usb-EC5C-3D0A# ls -l
drwxr-xr-x    6 root     root         4096 Jun 26 21:15 pyserial-2.5-rc2
drwxrwxrwx    4 root     root         4096 Jan 10 13:51 python2.6-chumby
</code>
</pre>
<p>You&#8217;re first instinct may be to try and install PySerial via the usual call to <code>python setup.py install</code>.  However this appears not to work.</p>
<p>All is not lost though &#8211; just manually copy the relevant directory (serial) from PySerial to the python site-packages directory, e.g.:</p>
<pre>
<code>
cp -r pyserial-2.5-rc2/serial python2.6-chumby/lib/python2.6/site-packages/
</code>
</pre>
<p>Know to check that&#8217;s worked open a python prompt and try to import the serial library:</p>
<pre>
<code>
chumby:/mnt/usb-EC5C-3D0A# python2.6-chumby/bin/python
Python 2.6.2 (r262:71600, May 23 2009, 22:28:43)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>>
</code>
</pre>
<p>If you don&#8217;t see any errors (as above) then everything has installed ok.</p>
<p>Next step is to try out connecting an Arduino.</p>
<p>So first off you&#8217;ll want to ensure the Arduino has a program that can read from the serial port &#8211; to show that everything is working ok.  In my case I picked my <a href="http://www.psychicorigami.com/2010/05/26/my-first-arduino-project-morse-code/">Morse Code program</a>.  This will read bytes from the serial port and toggle the built-in LED (on pin 13), so it&#8217;s handy for verifying the serial port is working.</p>
<p>So now you have a program loaded on the Arduino, connect it to the Chumby.  The Arduino should get enough power from the Chumby to start up ok.</p>
<p>You need to work out which serial port the Arduino is using on the Chumby.  List the tty&#8217;s in /dev and pick the most likely looking one (should have USB in it&#8217;s name):</p>
<pre>
<code>
chumby:/mnt/usb-EC5C-3D0A# ls /dev/tty*
/dev/tty      /dev/ttyS00   /dev/ttyS02   /dev/ttyS1    /dev/ttyS3
/dev/ttyS0    /dev/ttyS01   /dev/ttyS03   /dev/ttyS2    /dev/ttyUSB0
</code>
</pre>
<p>On my Chumby the serial port was <code>/dev/ttyUSB0</code>.</p>
<p>Now open up a python prompt again and try talking to the Arduino.  You&#8217;ll need to configure the baud-rate of the serial port to match the program on the Chumby.  In my case this was 9600.</p>
<pre>
<code>

chumby:/mnt/usb-EC5C-3D0A# python2.6-chumby/bin/python
Python 2.6.2 (r262:71600, May 23 2009, 22:28:43)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
>>> ser.write('sos')
3
</code>
</pre>
<p>If you are using the same morse code program you should see the LED blink out &#8216;DOT-DOT-DOT DASH-DASH-DASH DOT-DOT-DOT&#8217; &#8211; confirming that the serial port works.</p>
<p>This is really quite handy, as the Chumby is a small low-power Linux server.  Coupled with Python this means it&#8217;s really easy to get any Arduino based project online, without needing a &#8220;normal&#8221; computer constantly running.  Not quite as self-contained as using an <a href="http://www.arduino.cc/en/Main/ArduinoEthernetShield">Ethernet Shield</a>, but the Chumby is fairly small, so it and an Arduino will easily sit on a window ledge (for example).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychicorigami.com/2010/06/26/chumby-to-arduino-communication-using-pyserial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chumby Podcast Client Source Code</title>
		<link>http://www.psychicorigami.com/2010/01/09/chumby-podcast-client-source-code/</link>
		<comments>http://www.psychicorigami.com/2010/01/09/chumby-podcast-client-source-code/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 18:46:54 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[chumby]]></category>

		<guid isPermaLink="false">http://www.psychicorigami.com/?p=250</guid>
		<description><![CDATA[Ok so I blogged about a podcatcher/podcast client for the Chumby quite a while ago (August 2008 to be precise). At the time I said I&#8217;d tidy things up and release the source code etc. Well that didn&#8217;t quite happen, but I figured I might as well release the source code. So seeing as I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Ok so I blogged about a <a href="http://www.psychicorigami.com/2008/08/23/chumby-podcatcher/">podcatcher/podcast client for the Chumby</a> quite a while ago (August 2008 to be precise).  At the time I said I&#8217;d tidy things up and release the source code etc.  Well that didn&#8217;t quite happen, but I figured I might as well release the source code.  So seeing as I&#8217;ve been using <a href="http://git-scm.com/">git</a> a lot lately and <a href="https://github.com/">github</a> is easy to use I thought that&#8217;d I&#8217;d best just put online what I had.</p>
<p>So you can now find the hybrid Python, Javascript and Flash <a href="http://www.chumby.com/">Chumby</a> postcast client I dubbed <a href="http://github.com/lilspikey/chumbycast">chumbycast, on github</a>.  I&#8217;m providing the code just for the curious &#8211; I&#8217;ve had at least one request for it, but I&#8217;m not really going to detail too much of how it works. Though some of this is outlined in the original post where I mentioned the project.</p>
<p>I am tempted to revive this project a bit, but probably by trying a different approach.  I mostly gave up on this as I was creating a UI on the Chumby in Flash and my Flash skills aren&#8217;t exactly great, plus I was trying to use <a href="http://www.mtasc.org/">mtasc</a> which hampered things further.  Which is not to belittle mtasc &#8211; it&#8217;s just with limited time and no previous Flash experience I wasn&#8217;t exactly helping myself by not using some nice friendly Flash IDE.</p>
<p>I&#8217;ve since realised that if I ditched the Flash UI I could probably get quite a bit done.  The Python httpserver side of things was pretty easy.  So if I focussed on that I would then have a few of ways of providing a UI by hijacking existing functionality on the Chumby.</p>
<ul>
<li>The Chumby runs a <a href="http://wiki.chumby.com/mediawiki/index.php/Chumby_as_an_iPod_server">httpserver on port 8080 when an ipod is plugged in</a>, which the UI uses to access playlists etc.  I could mimic this approach and effectively make the podcast client look like an iPod as far as the Chumby&#8217;s UI was concerned.  By plugging in a USB stick loaded up with the podcast client everything would behave the same as if you had plugged in an iPod.</li>
<li>It&#8217;s possible to <a href="http://wiki.chumby.com/mediawiki/index.php/Chumby_and_music">create playlist files and edit the &#8220;My Streams&#8221;</a> section programmatically.  Each podcast subscribed to would create a matching pls or m3u file and be added to the &#8220;My Streams&#8221; section.</li>
<li>Create a javascript/web UI for controlling the playback and subscriptions to podcasts and other podcast management tasks (like removing old files, manually downloading older episodes etc) from another computer.  Possibly adding bonjour/zero-conf support so the Chumby can be browsed to easily</li>
</ul>
<p>I would need to see whether those first two could be made to work for my purpose, but it would make sense to just use the existing UI on the Chumby &#8211; rather than creating a new one.  The existing chumbycast code already provides a javascript/web UI for controlling the playback on the Chumby.  This was originally done so I could remote control the chumby, but also so that I could easily create and debug an API for the Flash UI to use.</p>
<p>The other major missing feature is allowing the podcasts to be paused part way through.  The current client does not support this, as the audio files are streamed and not downloaded.  So that would be the first change to make.  Now that I&#8217;ve dug out the code maybe I&#8217;ll be inspired to play around some more.  I&#8217;ve also been listening to a lot more podcasts (thanks to <a href="http://huffduffer.com/">Huffduffer</a>) so it might happen yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychicorigami.com/2010/01/09/chumby-podcast-client-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chumby podcatcher</title>
		<link>http://www.psychicorigami.com/2008/08/23/chumby-podcatcher/</link>
		<comments>http://www.psychicorigami.com/2008/08/23/chumby-podcatcher/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 18:04:22 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[chumby]]></category>
		<category><![CDATA[£5app]]></category>

		<guid isPermaLink="false">http://psychicorigami.com/?p=148</guid>
		<description><![CDATA[Here&#8217;s a video of my Chumby podcatcher (podcasting client) in action: And a couple of photos: Just finished getting a UI working on the Chumby. Last week I had the basic http server running in the Chumby and I could browse to it from my laptop and control it that way. Today I managed to [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a video of my <a href='http://chumby.com/'>Chumby</a> podcatcher (podcasting client) in action:<br />
<center><br />
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.flickr.com/apps/video/stewart.swf?v=59154" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&amp;photo_secret=d939820af0&amp;photo_id=2789376985&amp;show_info_box=true"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=59154"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=59154" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&amp;photo_secret=d939820af0&amp;photo_id=2789376985&amp;flickr_show_info_box=true" height="300" width="400"></embed></object><br />
</center></p>
<p>And a couple of photos:</p>
<p><center><br />
<a href="http://www.flickr.com/photos/lilspikey/2790118482/" title="Chumby USB stick for podcatcher by lilspikey, on Flickr"><img src="http://farm4.static.flickr.com/3050/2790118482_809b731958_m.jpg" width="240" height="180" alt="Chumby USB stick for podcatcher" /></a> <a href="http://www.flickr.com/photos/lilspikey/2790116810/" title="Chumby Podcatcher by lilspikey, on Flickr"><img src="http://farm4.static.flickr.com/3034/2790116810_a000530732_m.jpg" width="240" height="180" alt="Chumby Podcatcher" /></a><br />
</center></p>
<p>Just finished getting a UI working on the Chumby.  Last week I had the basic http server running in the Chumby and I could browse to it from my laptop and control it that way.  Today I managed to get a simple flash widget written that interacts with that server, so a laptop isn&#8217;t needed.</p>
<p>The http server is written in Python (see <a href='http://wiki.chumby.com/mediawiki/index.php/Python'>here</a> for info on running Python on the chumby).  It has the job of downloading the feeds and interacting with the audio server on the chumby (called <a href='http://wiki.chumby.com/mediawiki/index.php/Controlling_BTplay'>btplay</a>).  It&#8217;s all pretty standard, except that the version of Python I was using didn&#8217;t have <a href='http://www.python.org/doc/lib/module-BaseHTTPServer.html'>BaseHTTPServer</a>.  This meant I had to roll my own (thankfully pretty easy) using the <a href='http://www.python.org/doc/lib/module-SocketServer.html'>SocketServer</a> module.</p>
<p>The UI is written in flash (using <a href='http://swfmill.org/'>swfmill</a> and <a href='http://www.mtasc.org/'>MTASC</a>) and talks to the server to find out about available episodes and to stop/start the audio.</p>
<p>Once I&#8217;ve used it for a bit and made sure it&#8217;s ready for use I&#8217;ll release it and the code behind it.  Hopefully other people will find it useful.  I know for me this has been one feature that I wish the Chumby already supported.  That&#8217;s the great thing about the Chumby though &#8211; if you want a feature bad enough you can just get in there and write it yourself!</p>
<p>I should also be talking about this app at the next <a href='http://fivepoundapp.com/'>£5app</a> (which should be late September).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychicorigami.com/2008/08/23/chumby-podcatcher/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A Second Chumby Widget</title>
		<link>http://www.psychicorigami.com/2008/07/17/a-second-chumby-widget/</link>
		<comments>http://www.psychicorigami.com/2008/07/17/a-second-chumby-widget/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 18:33:28 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[chumby]]></category>

		<guid isPermaLink="false">http://psychicorigami.com/?p=143</guid>
		<description><![CDATA[I finally had a chance to do some more Actionscript coding for the Chumby again. The last widget I did was the bare minimum to get going and this one is only a little more advanced. In particular it&#8217;s a simple analogue clock. All it does is show the current time, nothing more, but it [...]]]></description>
			<content:encoded><![CDATA[<p>I finally had a chance to do some more Actionscript coding for the <a href='http://chumby.com/'>Chumby</a> again.  The <a href='http://psychicorigami.com/2008/05/29/hello-chumby-a-first-widget/'>last widget</a> I did was the bare minimum to get going and this one is only a little more advanced.  In particular it&#8217;s a simple analogue clock.  All it does is show the current time, nothing more, but it does involve a few more &#8220;moving parts&#8221; than were involved in the &#8220;Hello World&#8221; widget from last time.</p>
<p>So to start off with here&#8217;s the scaled down scan I used for the clock face and hands:</p>
<p><center><a href='http://psychicorigami.com/wp-content/uploads/2008/07/clock_parts.png'><img src="http://psychicorigami.com/wp-content/uploads/2008/07/clock_parts.png" alt="" title="clock_parts" width="427" height="240" class="alignnone size-full wp-image-145" /></a></center></p>
<p>I cut out the face and hands and put them into separate files (see .tar.gz below) for using in the Actionscript.  All images were 24bit PNGs with variable alpha transparency, so that the edges look nice and smooth on the Chumby screen (which is relatively low resolution).</p>
<p>The Actionscript (<code>ChumbyClock.as</code>) is very simple and looks like this:</p>
<p><code>
<pre>

class ChumbyClock extends MovieClip {
	var hourHand:MovieClip;
	var minHand:MovieClip;
	var secHand:MovieClip;

	function onLoad() {
		this.hourHand = loadHand('hour_hand');
		this.minHand  = loadHand('minute_hand');
		this.secHand  = loadHand('second_hand');
	}

	function loadHand(hand_id:String) {
		var clip = this.createEmptyMovieClip("clip", this.getNextHighestDepth());
		clip._x = 160;
		clip._y = 120;

		// load image an shift it to be in 12 o'clock position
		// with 0,0 as middle of bottom of image
		var hand = clip.attachMovie(hand_id, 'hand', clip.getNextHighestDepth());
		hand._x = -hand._width/2;
		hand._y = -hand._height + (hand._width/2);
		return clip;
	}

	function toDegrees(val:Number, range:Number) {
		return (360*(val % range))/range;
	}

	function onEnterFrame() {
		var now:Date = new Date();

		var sec:Number = now.getSeconds();
		secHand._rotation = toDegrees(sec, 60);

		var min:Number = now.getMinutes();
		minHand._rotation = toDegrees(min, 60);

		// let hour hand move a little bit with min hand
		var hourWithMin:Number = now.getHours() + min/60.0;
		hourHand._rotation = toDegrees(hourWithMin, 12);
	}

}
</pre>
<p></code></p>
<p>All this does is create three movies which contain the hand images, placed so they are in the 12 O&#8217;Clock position.  At each timestep (<code>onEnterFrame</code>) the current time is queried and the hand rotations are updated.  The second and minute hands are just rotated in proportion with the relevant values.  The hour hand is also slightly rotated with the current minute.  As we get nearer the end of the hour, the hour hand moves nearer to the next hour.  Much as you&#8217;d expected for a real clock.  That&#8217;s it.  I did play around with having smoother animation for the hands, but it looked a bit eery.</p>
<p>To tie the Actionscript and images together there is an xml file (<code>app.xml</code>) used by <code>swfmill</code>:</p>
<p><code>
<pre>
&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;movie width="320" height="240" framerate="12"&gt;
  &lt;background color="#ffffff"/&gt;
  &lt;clip import="build/classes.swf" /&gt;

  &lt;frame&gt;
    &lt;library&gt;
      &lt;clip id="face"        import="images/hand_drawn/face.png" /&gt;
      &lt;clip id="hour_hand"   import="images/hand_drawn/hour_hand.png"  /&gt;
      &lt;clip id="minute_hand" import="images/hand_drawn/minute_hand.png"/&gt;
      &lt;clip id="second_hand" import="images/hand_drawn/second_hand.png"/&gt;
      &lt;clip id="app" class="ChumbyClock" /&gt;
    &lt;/library&gt;

    &lt;place id="face" name="clockFace" depth="0" /&gt;
    &lt;place id="app" name="myApp" depth="1" /&gt;
  &lt;/frame&gt;
&lt;/movie&gt;
</pre>
<p></code></p>
<p>This will allow us to embed the PNGs in the generated SWF file and reference them from the Actionscript.  In addition the clock face image is placed statically behind the main movie of the hands.</p>
<p>These files are then run through a build script to generate the SWF:</p>
<p><code>
<pre>
~/bin/mtasc-1.12-osx/mtasc -swf build/classes.swf -header 320:240:12 ChumbyClock.as
~/bin/swfmill-0.2.12-macosx/swfmill simple app.xml chumbyclock.swf
</pre>
<p></code></p>
<p>Here&#8217;s the generated SWF:</p>
<p><center><br />
<embed style="border: 1px solid black" src="http://psychicorigami.com/wp-content/uploads/2008/07/chumbyclock.swf" width="320" height="240" /><br />
</center></p>
<p>To test this on the Chumby I put the SWF on a memory stick along with this <code>debugchumby</code> script:</p>
<p><code>
<pre>
#!/bin/sh
chumbyflashplayer.x -i /mnt/usb/chumbyclock.swf
</pre>
<p></code></p>
<p>Then when the Chumby is rebooted with the memory stick in the clock displays and all is good.</p>
<p>So there you go that&#8217;s a simple clock widget for the Chumby &#8211; using open source tools.</p>
<p><a href='http://psychicorigami.com/wp-content/uploads/2008/07/chumbyclocktar.gz'>Download Widget Source Code and Images.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychicorigami.com/2008/07/17/a-second-chumby-widget/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hello Chumby! (a first widget)</title>
		<link>http://www.psychicorigami.com/2008/05/29/hello-chumby-a-first-widget/</link>
		<comments>http://www.psychicorigami.com/2008/05/29/hello-chumby-a-first-widget/#comments</comments>
		<pubDate>Thu, 29 May 2008 19:33:06 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[chumby]]></category>

		<guid isPermaLink="false">http://psychicorigami.com/?p=137</guid>
		<description><![CDATA[So now that I&#8217;ve got the Chumby it seemed like a good idea to test out creating and uploading my first widget. This is my first foray into flash development, so for the moment I&#8217;m just cribbing from other sources. I&#8217;m hoping that as Actionscript is a cousin of Javascript it won&#8217;t be too tricky [...]]]></description>
			<content:encoded><![CDATA[<p>So now that I&#8217;ve got the <a href='http://www.chumby.com/'>Chumby</a> it seemed like a good idea to test out creating and uploading my first widget.</p>
<p>This is my first foray into <a href='http://en.wikipedia.org/wiki/Adobe_Flash'>flash</a> development, so for the moment I&#8217;m just cribbing from other sources.  I&#8217;m hoping that as <a href='http://en.wikipedia.org/wiki/ActionScript'>Actionscript</a> is a cousin of <a href='http://en.wikipedia.org/wiki/JavaScript'>Javascript</a> it won&#8217;t be too tricky to pick up.  Though of course much of the learning will be related to the various APIs.</p>
<p>To get started I ran over to <a href='http://osflash.org/'>Open Source Flash</a> and read the article on <a href='http://osflash.org/projectsetup'>setting up a flash project without using the Flash IDE</a> (seeing as I don&#8217;t want to buy Flash &#8211; for now at least).  I then followed through from there to the <a href='http://www.mtasc.org/'>MTASC</a> site and looked at the example <a href='http://www.mtasc.org/#tutorial'>tutorial</a> and realised that may be all I needed to get a simple &#8220;Hello World&#8221; widget working.</p>
<p>So here&#8217;s the Actionscript I used (saved in <code>Tuto.as</code>):</p>
<pre><code>
class Tuto {

    static var app : Tuto;

    function Tuto() {
        _root.createTextField("tf",0,0,0,320,240);
        // write some text into it
        _root.tf.text = "Hello\nChumby!";

        // make the text appear bigger on the screen
        var format = new TextFormat();
        format.size = 64;
        _root.tf.setTextFormat(format);
    }

    // entry point
    static function main(mc) {
        app = new Tuto();
    }
}
</code></pre>
<p>Which is based on the code in the MTASC tutorial.</p>
<p>Then with MTASC downloaded and installed in <code>~/bin/mtasc-1.12-osx/</code> on my Powerbook, I compiled the code using:</p>
<pre><code>~/bin/mtasc-1.12-osx/mtasc -swf tuto.swf -main -header 320:240:12 Tuto.as</code></pre>
<p>Which creates the SWF file <code>tuto.swf</code>.</p>
<p>Note the <code>-header 320:240:12</code> option.  This is to set the size (320&#215;240) and framerate (12fps) of the resulting SWF.  These are the settings as required for the Chumby.</p>
<p>With that done I then tried out <code>tuto.swf</code> in my web-browser to make sure it worked.  Next I uploaded the widget via chumby.com (which meant I had to create an 80&#215;60 pixel icon too).  I made sure that the widget was set to private when uploading (seeing as only I wanted to see the widget) and then added it to my &#8220;development&#8221; channel.</p>
<p>Then I selected the &#8220;development&#8221; channel on my chumby to see the results:</p>
<p><center><img src="http://psychicorigami.com/wp-content/uploads/2008/05/img_5100.jpg" alt="" title="Hello Chumby!" width="480" height="388" class="alignnone size-full wp-image-138" /></center></p>
<p>I did run into a little trouble getting the widget to refresh after uploading.  It seemed to work sometimes, but in the end I <a href='http://wiki.chumby.com/mediawiki/index.php/Chumby_tricks#Hidden_screen_in_Control_Panel'>started sshd on the chumby</a> so I could stop and start the control panel (after connecting via ssh):</p>
<pre><code>
chumby:~# stop_control_panel
chumby:~# start_control_panel
</code></pre>
<p>Which seemed to solve the trick.  I&#8217;ll have to investigate other means of deploying to the chumby when I&#8217;m properly developing, but overall it wasn&#8217;t too much effort going via the chumby site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychicorigami.com/2008/05/29/hello-chumby-a-first-widget/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Unpacking Chumby</title>
		<link>http://www.psychicorigami.com/2008/05/28/unpacking-chumby/</link>
		<comments>http://www.psychicorigami.com/2008/05/28/unpacking-chumby/#comments</comments>
		<pubDate>Wed, 28 May 2008 19:56:21 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[chumby]]></category>

		<guid isPermaLink="false">http://psychicorigami.com/?p=135</guid>
		<description><![CDATA[So the Chumby finally arrived today. Heather had very kindly and sneakily managed to arrange for it to be sent from the US (seeing as it&#8217;s not yet available over here in the UK) for my 30th. I have to say that so far I&#8217;m pretty impressed. It&#8217;s got that geek gadget factor working for [...]]]></description>
			<content:encoded><![CDATA[<p>So the <a href='http://www.chumby.com/'>Chumby</a> finally arrived today.  Heather had very kindly and sneakily managed to arrange for it to be sent from the US (seeing as it&#8217;s not yet available over here in the UK) for my 30th.  I have to say that so far I&#8217;m pretty impressed.</p>
<p>It&#8217;s got that geek gadget factor working for it very well.  Lots of options to configure, but at the same time it&#8217;s pretty easy to use.  Lots more exploring to do, but even just the fact that it&#8217;ll play <a href='http://radioparadise.com/'>Radio Paradise</a> out of the box is enough for me&#8230;</p>
<p><center><br />
<a href="http://www.flickr.com/photos/lilspikey/2532030940/" title="IMG_5090 by lilspikey, on Flickr"><img src="http://farm4.static.flickr.com/3134/2532030940_87b9bb09b2.jpg" width="500" height="400" alt="IMG_5090" /></a></p>
<p><a href="http://www.flickr.com/photos/lilspikey/2532030168/" title="IMG_5093 by lilspikey, on Flickr"><img src="http://farm3.static.flickr.com/2030/2532030168_125937d92c.jpg" width="500" height="400" alt="IMG_5093" /></a></p>
<p><a href="http://www.flickr.com/photos/lilspikey/2532031210/" title="IMG_5097 by lilspikey, on Flickr"><img src="http://farm3.static.flickr.com/2290/2532031210_c155f52a01.jpg" width="500" height="400" alt="IMG_5097" /></a><br />
</center></p>
<p><a href='http://www.flickr.com/photos/lilspikey/tags/chumby/'>See more chumby photos</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychicorigami.com/2008/05/28/unpacking-chumby/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
