Tuesday, February 17, 2009

TouchShield processing bubbles

I can't believe it took me this long to upload this little app, converted to the TouchShield Slide. It's the fun little Processing demo app where you touch your finger to the screen, and various sized bubbles are drawn in a concentric radius around your touch... the bubbles get bigger the further out you go.



This is made possible with Mark's new and improved super-fast (and I'll add, actually functional!) graphics library :)



I've uploaded the code to the app store here, but in the meantime here's the heart of the functionality (notice it's still copied line for line from the Processing demo book, since all the functions are ported!):


for(int i = 0; i <= width; i += 20) {
for(int j = 0; j <= width; j += 20) {
float size = dist(mouseX, mouseY, i, j);
size = size/max_distance * 15;
ellipse(i, j, size, size);
}
}




Oh yeah, and it occured to me that I've done a really bad job at uploaded all the quirky little source code snippets I've written for the TouchShield Slide over the past few months, so I think I'll do my best and try to release an app or two each day the next week!

12 comments:

Isi said...

Thanks, its an interesting algorithm :) Good job!

Unknown said...

Question...

Is there an easier way to download the new touchshield core? I manually D/L'd the individual files from the github, but couldn't find a way to download the whole enchilada -- I could only get the older cores.

Thanks,

Sasha

Chris said...

Sasha,

Your totally right, pulling the cores manually from github is a pain. They do have the "download as zip" feature, which makes grabbing all cores slightly easier.

You also bring up a good point, the Arduino package should be synced up tighter with the new cores.

So that's why I'll work with Omar to bang out another package. Lets say, in about a day?

Hope that helps.

Isi said...

Sasha meanwhile I have uploaded all the new cores here in order to can work with them:

http://www.servidor.asia/arduino/touchSlideNewCores.rar

Unknown said...

I can't seem to get that new core to work, am I not including the SubPGraphics library?


OLD SubPGraphics.cpp
void background(uint8_t redValue, uint8_t greenValue, uint8_t blueValue)
{
setbcolor(redValue, greenValue, blueValue);
fillback();
}


NEW SubPGraphics.cpp
void background(uint8_t redValue, uint8_t greenValue, uint8_t blueValue)
{
setbcolor(redValue, greenValue, blueValue);
fillback();
}

by the way, nice graphic Matt! I think you just inspired my next project.

Isi said...

Mike you have to include this line:

#include "SubPGraphics.h"

Download the new core files from this url:

http://www.servidor.asia/arduino/touchSlideNewCores.rar

And then replace all the files in the slide with that ones.

Add the line #include "SubPGraphics.h" to your programas

Tell me if it works please. Isidro.

Unknown said...

Thanks all. Hope I didn't come across as demanding -- re-reading my post, I seemed rather terse... Meant to add that the processing demo is cool. I tried the same thing with the 'circles that change size and stroke-color based on mouse velocity' sketch as well...can't remember the name off the top of my head.

I thought I posted a second comment as well...

I, too, noticed the need to 'include' SubPGraphics.

I was also wondering if Mark S could give a hint as to how to use the Hershey fonts. When I tried 'including' some of the hershey files and calling some functions I could not compile.

Thanks again for posting the new files, all the great work and I look forward to a new Arduino package.

Also, here is a video of my Arduino/Touchshield clock...

http://www.youtube.com/watch?v=BK2OXjHTuEI

Thanks,

Sasha

Matt said...

@Sasha - nope, not at all ... I'm a total beginner when it comes to github personally, so I honestly don't know the first thing when it comes to pulling code from it (cough Chris help cough)... And speaking of ... whoa! That video was officially ridiculously cool... where is the time coming from?! Can I write a blog article about it or maybe do you have a blog that I can link to? Were you thinking of maybe possibly sharing your code (and maybe making it the official first non-Mike, non-Chris, non-Matt "app" for the slide on the app store?!?!!) Ha I guess I can always hope... :-)

Isi said...

jaja i also love that example!! It is possible to download the code from anywhere?

Try using HersheyFonts like this:

char cadena1[]="HELLO";

void setup()
{
background(0,0,0);
stroke(40, 153, 224);
HersheyDrawCString(4,60,80, cadena1, 30, 0, 1);
}

All of them are NUMBERS not CHARACTHERS because they are short ints ok? Tell me if it works with than change. Isidro.

Unknown said...

Matt --

The latest version of my clock is using a Real-time-clock chip for time keeping duties, a light sensor and an accelerometer(thanks to sparkfun). An earlier version I made was faking the time via an ~800ms delay. I'll totally find the older code(clean it up to prevent embarrassment) and send it to you for the app store(I'll even send the current code that has all the serial/i2c stuff, though it won't be as useful without the peripheral chips). I'd be flattered if you blogged about it ^_^. I'll write up a description of what is going on and send it as well.

i'll see if I can find any other goodies.. I had a fun program that draws a grid of squares whose colors are based on touch input...(have you noticed that if you touch two places at once it seems to average the x,y values? Poorman's multi-touch...)

Thanks,

Sasha

Unknown said...

Here is a link to a few programs...

http://www.thefloatingrock.com/arduino.html

I'll add some more and a write up of the 'proper' clock project...

- Sasha

Isi said...

Sasha thanks for that code! The clock is fantastic :)