Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.

Widget programming
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Widget programming

by irritantno9 on Thu Jun 05, 2008 4:15 pm

I'm really not too bright when it comes to any kind of programming. I ordered an Ybox. What kind of learning curve is there for programming the widgets?

Posts: 22
Joined: Thu Jun 05, 2008 4:12 pm

by darco on Thu Jun 05, 2008 8:25 pm

In general it is not terribly difficult to modify one of the given example widgets to do something different. Ultimately, the difficulty involved depends on what you want your widget to do.

Spin is not a terribly difficult language to learn, but if you are already familiar with languages like C you will find the syntax to be bizarre. If you aren't much of a programmer, then this isn't really an area of concern.

There is plenty of documentation about how to write programs for the propeller (and, thus, the ybox2) on the parallax propeller website.
Posts: 118
Joined: Wed Jun 04, 2008 7:54 pm
Location: Campbell, CA

by irritantno9 on Fri Jun 06, 2008 7:50 am

The documentation on the Widgets seems to be lacking (Maybe I'm looking in the wrong place). There is an infrared receiver on the ybox2 board: Does this function to switch between the different 'widgets' ?

I'm not sure I understand that part.

Can the ybox2 hold more than one widget at a time? How many in Total is more than one?

I took "Intro to C with Unix" in college. When the professor stated that this 'would be easy for all you Fortran programmers', I knew I was doomed!

She didn't say anything about the Atari800 programmers...

Fortunately I dropped the class before I got too far behind.

Posts: 22
Joined: Thu Jun 05, 2008 4:12 pm

by darco on Fri Jun 06, 2008 1:44 pm

I'm working on a larger FAQ, and a few of the questions I've added may help explain things, so I'll paste the relevant bits here:


Q: What is a Widget?

A: A "widget" is simply a program which runs on the ybox2, which can be uploaded to the device via the bootloader. These programs can do a variety of things, such as poll the internet for weather info, a networked alarm clock, and a twitter client.


Q: Can I run more than one widget at the same time?

A: Only one program can be uploaded to the ybox2 at a time, due to memory constraints. Everything, including the TCP/IP stack, must fit in 32KB. As further development continues, I anticipate that the programs will become more rich with features, and perhaps some widgets will be merged.


Q: I notice there is an IR port. What kind of remote control will I need?

A: The IR port will work with any remote control which is modulated between 38-42KHz. Most IR remotes are in this category. At the moment however, none of the widgets are really using the IR port. This will likely change in the future. An IR test feature is built into the bootloader, which will flash the LED when a button on any compatible remote is pressed.
Posts: 118
Joined: Wed Jun 04, 2008 7:54 pm
Location: Campbell, CA


by irritantno9 on Fri Jun 06, 2008 4:29 pm

So only one widget at a time.
maybe in the future you'll be able to check the weather and check twitter etc. Or is that too far out of the realm of the memory constraints?

I'm just going to hope that some generous programmers will let me look over their 'shoulders'.

Thanks for the mini FAQ

Look forward to getting the thing and putting it together.

Posts: 22
Joined: Thu Jun 05, 2008 4:12 pm

by adafruit on Sat Jun 07, 2008 4:34 pm

you can 'fake' a more complex widget by simply pointing the defaut 'infowidget' at a website you control and having the webpage generate the content (like a .php or cgi script)

Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by RobPattonDotCom on Fri Jun 13, 2008 11:46 pm

Just got my kit in, 30 mins, and it all worked dandy the first time. those the instructions make note of a 4 pin header, which wasnt in my kit...

Moving forward with the "'fake' a more complex widget" direction, I did just that, but I've not been able to get text formatting correct. I have some asp code that builds the screen, but since this thing isnt an html parser, obviously things like <br> or <pre> or all the handy text formatting options just don't work.

I've spent some time sorting through the propller book, but I have yet to take notice of any text formatting stuff.

Is there? Or am I asking for to much?
Posts: 1
Joined: Fri Jun 13, 2008 11:03 pm
Location: Orlando, Fl

by harrison on Sat Jun 14, 2008 3:53 am

The info widget is really simple and just forwards all bytes to the tv_text driver. You'll probably want to look at tv_text.spin to get an idea how it handles display formatting.

For quick reference, here are the TV_Text supported 'formatting' options:
Code: Select all | TOGGLE FULL SIZE
''     $00 = clear screen
''     $01 = home
''     $08 = backspace
''     $09 = tab (8 spaces per)
''     $0A = set X position (X follows)
''     $0B = set Y position (Y follows)
''     $0C = set color (color follows)
''     $0D = return
''  others = printable characters

You can also view what propserve.fwdweb.com outputs on your browser by setting a 'debug' argument: http://propserve.fwdweb.com/?zipcode=77546&debug
Posts: 8
Joined: Mon Jun 09, 2008 3:55 am
Location: Texas

Please be positive and constructive with your questions and comments.