I have created a functional base64 encoding method for the ybox.
It’s not ideal as it requires the programmer to declare an output array large enough to hold the result of the encoding procedure. I tried everything I could think of to avoid this by using the size of the input string (strsize(in_ptr)*(4/3)) to store the output, but I couldn’t get it.
Download the updated base64.spin.
Sample usage:
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
text : "TV_Text"
b64 : "base64"
VAR
byte outstring[25]
PUB start | i
text.start(12)
b64.encode(string("admin:admin"), @outstring)
text.str(@outstring)
text.out(13)
b64.encode(string("admin:password"), @outstring)
text.str(@outstring)
text.out(13)
b64.encode(string("Die SPIN Die!"), @outstring)
text.str(@outstring)
text.out(13)
b64.encode(string("meh"), @outstring)
text.str(@outstring)
repeat
And a sample image from the above code:

If anyone has any tips that can help get rid of the need to declare the output variable’s size, please let me know. Tim

Well, it’s not very interesting (yet?) but I started working on a uTorrent download monitor using the ybox2. At the moment, it’s really nothing more than a simple hack. The ybox2 is running a slightly modified infowidget. When I say slightly modified, I mean I added one line to insert a Basic base64 authentication header for the uTorrent webserver:
tel.txmimeheader(string(“User-Agent”),string(“PropTCP”)) tel.txmimeheader(string(“Connection”),string(“close”)) tel.txmimeheader(string(“Authorization”),string(“Basic YWRtaW46YWRtaW4=”)) tel.str(@CR_LF)
I haven’t figured out how to write my own base64 encoding routine in Spin yet, so for the time being, I used python to generate the base64 encoding of the default username/password for the uTorrent web server (admin:admin).
Apart from that, I’m using a uTorrent python library on the web server to generate a properly formatted document for the infowidget and the file is updated every minute by the Windows Task Scheduler: The simple python script can be found at http://pastebin.com/f2a47b927.
TODO:
- There’s a lot that I’d like to do, but I’m currently in the midst of a hate/hate relationship with Spin.
- Ideally, I’d like to create a base64 encoder routine, and create a set of routines in Spin that can query the uTorrent webui natively without the python proxy.
- If/when that happens, I’d like to add remote control, scrolling, and the ability to select a download to view details. We’ll see how my relationship with Spin evolves. I’m not exactly a good programmer to begin with, and Spin is shaking me up pretty good.
The spin language used by the Parallax Propeller chip is pretty brutal. There are quite a few little nuances that go against everything you’ve ever learned in your intro to programming courses. I felt kind of like a hacker in the mid 80’s when I got overly excited to see a simple “Hello World” type application on the screen.
It’s really not the language or the chip that’s difficult, per say, but rather the ybox2 specific libraries that implement the TCP/IP stack. A lot of the code is left up to your application, so even the simplest of the network-enabled widgets work out to around 300 lines of code. That’s a lot to digest when you’re just learning a new architecture and language.
Not to mention I’ve been pretty spoiled by Visual Studio and Eclipse for the past 4-5 years. I’m so used to having all the documentation described to me as I type, that having to find the source files and check what methods/constants/variables are available is a real drag!
My wife bought me a ybox2 for Christmas and I just got around to assembling it this weekend. The ybox is a pretty amazing little ethernet enabled set-top box gadget that gives you the ability to create your own widgets which can be displayed on your TV. I have a couple of widgets in mind that I’d like to create, but the ybox uses a proprietary Parallax Propeller chip, which requires you write code in either Spin (which looks like Pascal threw up on win32 asm) or straight assembly code. Oh joy…
I just realized that the latest Wordpress update had messed up the embedded video on the Bongopong page. I fixed it, so you can laugh along with me (at me).
On a side note, the biggest thing I heard about that project was that it looked too hard. Rest assured that it was difficult because I was using a DIY Bongoboard and the skateboard deck has a concave bottom – coupled, of course with my complete lack of coordination and balance.
My wife got me a real Bongoboard for Christmas this year, and it’s 100 times easier to use. I may have to bring this one back. With a left/right moving game like breakout and a stable board, I think this could be a lot of fun.


