Flash + Papervision 3D + Arduino

March 24th, 2008

In my second little project today, I modified the circuit I built for the Flash etch-a-sketch, by adding another potentiometer and 3 LEDs, each of which represents the voltage of each pot (using pulse-width modulation to ‘dim’ the LED).

Each pot is responsible for either the pitch, yaw, or roll of a cube in PV3D.

Simple stuff that’s been done before! I think I need to think of something a bit more interesting now :D

Flash + Papervision 3D + Arduino

Flash + Papervision 3D + Arduino


f

Etch-a-sketch using Flash and Arduino

March 23rd, 2008

Well, I had nothing much better to do today, so after sorting out my previous problems with Arduino and Flash, I thought i’d connect 2 potentiometers to the Arduino board, and make….. Yezzer-sketch!

Here’s the on-screen result:
Yezzer - sketch. Using Flash + Arduino

The very simple circuit:
Yezzer - sketch. Using Flash + Arduino

Video:

I need to get some better potentiometers, these are pretty rubbish.

Yey for making … stuff! :D

Getting Flash and Arduino talking, and problems with AS3

March 23rd, 2008

Over the last year, i’ve heard a lot about Arduino, so I was quite gutted when I missed out on both the Arduino talk at BarcampBrighton2, and also on the Arduino session a few days later at FlashBrighton!
Nevertheless, I had to get an Arduino board and start experimenting. Jo had a few Arduino boards, so kindly dropped one round for me.

For me, the most interesting aspect is using the Arduino in conjunction with Flash, sending and recieiving data betwen the two. I realy like the twitter > flash > arduino > LCD display that Mario made. I found it quite inspirational.

Getting Flash and the Arduino talking is initially very, very easy. It takes no time at all to initially write your first “hello world” app - in this case a blinking LED. After that, I turned my attention to reading the output of a potentiometer, and display that in Flash. Again, this is very easy, espically when people have done it already, and you can copy and paste their code! Thanks Beltran, Brett, and Aral for sharing your code!
In no time I had a potentiometer controlling the brightness of an LED, and the Arduino writing the data to the serial port, which Flash was trace()ing to the output window.

Nothing’s that easy though, right? Indeed. I’m expecting values between 0 and 1023, and specifically in this instance, around 1023. This is what I got:

15:37:53:104 = 102
15:37:53:135 = 3
15:37:54:104 = 1023
15:37:55:119 = 1023
15:37:56:135 = 1023
15:37:57:119 = 102
15:37:57:135 = 3
15:37:58:119 = 1023
15:37:59:135 = 1023
15:38:0:151 = 1023
15:38:1:135 = 10
15:38:1:151 = 23
15:38:2:151 = 1023

How strange. As you can see, occasionally the output is split over more than one line. It also does the same on my laptop.
After a lot of hair-pulling, I’ve made a couple of examples, which you can test if you wish. You’ll need to change the port to the one serproxy (or equivalent) is set up to use.

Arduino code:
[code]
void setup()
{
Serial.begin(9600);
}

void loop()
{
Serial.println(”hello”);
delay(100);
}
[/code]

Actionscript 3 code:
[code]
import flash.events.*;
import flash.net.Socket;

trace(”__AS3 Example__”);
var socket:Socket = new Socket(”localhost”,5335);
socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
function socketDataHandler(event:ProgressEvent):void {
var now = new Date();
trace(now.getHours()+”:”+now.getMinutes()+”:”+now.getSeconds()+”:”+now.getMilliseconds()+” = “+socket.readUTFBytes(socket.bytesAvailable));
}
[/code]

Actionscript 2 code:
[code]
trace(”__AS2 Example__”);
var socket:XMLSocket = new XMLSocket();
socket.connect(”localhost”,5335);
socket.onData = function (data) {
var now = new Date();
trace(now.getHours()+”:”+now.getMinutes()+”:”+now.getSeconds()+”:”+now.getMilliseconds()+” = “+data);
}

[/code]

AS3 Output:

12:10:43:140 = hello

12:10:43:234 = hel
12:10:43:250 = lo

12:10:43:359 = hello

12:10:43:453 = h
12:10:43:453 = ello

12:10:43:562 = hello

AS2 Output:

12:11:25:406 = hello

12:11:25:515 = hello

12:11:25:625 = hello

12:11:25:718 = hello

12:11:25:812 = hello

12:11:25:921 = hello

AS3 has odd output, and AS2 has the expected output. It’s almost as if ProgressEvent.SOCKET_DATA is called too frequently?
I’ve looked at this, which may be a similar problem. Here’s my post on the Arduino forum which I wrote as I experienced the problem.

In the end I found AS3Glue, which “is an ActionScript 3 library that enables communication between Flash/Flex/AIR applications and Arduino boards”. This changes the way in which AS3 and the Arduino communicate, and fortunately solves the problem described above.

If you use AS3glue, you’ll also need to use the Arduino Firmata firmware. The firmware page also briefly mentions:

It turns out that the USB-serial drivers are optimized for fast bulk data transfer, and those optimizations actually wreak havoc with the timing of the messages over the USB-serial.

Perhaps that’s the problem i’ve experienced? If I can, i’d like to find out exactly what’s going on, but for now, as3glue will suffice :) If you can, please have a test and let me know if you get the same output!

Diebold accidentally leaks US Election results early

February 27th, 2008

Brilliant :)


Diebold Accidentally Leaks Results Of 2008 Election Early

market share
dodge caliber
diesel jeans
ochelari soare
catalog plante
bilete tratament pensionari
accesorii acvariu
premii reviste
addicted to love
free dating service
armor etrust ez

Bow Street Runner

February 21st, 2008

I’ve been insanely busy at work recently, working on a huge Flash game for Channel 4. I’ve kept schtum about it all, with only a few hints to what’s been going on to the outside world.

On the 11th Feb, Channel 4 released a preview of Episode 1 to the world, and it’s been picked up by the blogosphere. My favourite moments so far have been seeing my dead body on the front page of Kotaku, and seeing my fat arse on the front page of my favourite site BoingBoing.

To my fellow programming friends, it’s all ActionScript 3, and no, I didn’t do the entire thing by myself ;)

Be warned, there’s a few bugs in this *preview* release. Oh, and there’s 4 more episodes to come in the very near future.

To show the grandkids, when i’m grey and old:

BoingBoing

Bow Street Runner

Kotaku

Bow Street Runner

Team Littleloud rocks!

View Flickr Images Fullscreen

December 29th, 2007

Snowdon panorama

After uploading a few panoramic photos to Flickr, I found that I really wasn’t too fond of the small image it displays. Asking a user to click all sizes > original just doesn’t cut it for me either.
I found myself thinking “Wouldn’t it be good if i could just click on a link to a fullscreen, panning image?” Well, what with Flickr’s API, and Flash’s StageDisplayState.FULL_SCREEN, I did just that..

This is only something i knocked up in the last couple of hours, so don’t be too harsh, it’s just alpha :D

Here’s a link directly to my app

Here’s a bookmarklet: View Fullscreen (add this to your favourites or drag and drop to your toolbar)

Here’s a link to an image of mine on Flickr

Of course, adding that bookmarklet to your toolbar means you can view anyone’s (public) image fullscreen. Just browse to their image and hit the bookmarklet :)

Best use of Flash award

December 9th, 2007


Best use of Flash award, originally uploaded by yezzer.

I’ve been far too busy to blog anything recently, so while i’ve got a spare 10 minutes, I thought i’d just write something about us winning the ‘Best use of Flash’ award at the Brighton web awards.

Yey :)

Respect to Fritz Solares!

Slingbox + n95 + TV out

November 13th, 2007


Slingbox + n95 + TV out, originally uploaded by yezzer.

Crazy. I’ve got my n95 and the Slingbox working, which is quite cool. i can control it remotely so I could watch stuff i’ve recorded, which is pretty neat.

Anyway, this goes like this:

Satellite > My satellite dish > sky+ box > Slingbox > router > interwebs > 3 > n95 > TV

I think it’s crazy that a mobile phone has TV out. Nokia really did pack then95 *full* of features.
Shame one of those features wasn’t a better battery :D

No iPhone for me!

November 9th, 2007

Oh how flippant I am. I could be a politician with my U-turn on policy overnight. Or perhaps I just found a better deal.. Well, i spent all last night asking people opinions, reading reviews, looking at providers and tariffs, and talking to customer services. And spamming twitter.

I currently spend £40-50pm with o2.

In the end the choice was:
1. Stay with o2 and get an iPhone. £269 plus £35pm tariff for 18 months. That gets you 200 minutes, 200 texts, and unlimited data.

2. Change to Three and get an n95. The deal there is:

  • N95 @ £15pm
  • Contract @ £15pm for 18 months.
  • Add-on X-series gold including Slingbox @ £10pm
  • £50 of accessory vouchers
  • £30 off my bill using the refer-a-friend thing.

That gives me: 1GB data transfer pm, free calls to skype users, a FREE slingbox, free viewing of recorded stuff on my slingbox, Orb (to access files on my home PC), mobilemail so i can have IMAP Gmail , free windows live messenger, 300 anytime anynetwork texts or minutes, 300 3 to 3 minutes, and 150 mins of video calls a month. Oh, and some free yahoo and ebay things that I haven’t really looked at yet.

The n95 also supprts 3G and other faster-than-edge technologies. Oh it has GPS too. And a 5MP camera with carl zeiss lens. I can transfer my number over too. Did i mention it supports SDHC, so can use up to 8GB cards?

Oh, and it’s not all locked down like the iPhone, which is the real killer for me.

I’d be crazy to go for the iPhone while deals like this are out there. So i went for the n95 last night. Yeah, the battery life is awful if you don’t turn off wifi scanning, but i had the same problem with my N80.


Buy Isotretinoin
cialis
prednisone online
generic cialis
propecia
buy celexa
buy topamax
buy zithromax
buy acomplia
buy accutane

If by any chance you want to join Three, I can get you £30 off on the recommend a friend thing - so do let me know, as i get £30 off too! :D

Update: A 16GB iPod touch is £254. So for the cost of a 8GB iPhone, you could get an n95 on three AND a 16GB iPod touch. Who in their right mind would buy an iPhone?

iPhone to have ‘unlimited’ unlimited data transfer rates

November 5th, 2007

Wow, this is great, and has sealed the fact that i’ll be (attempting) to get an iPhone on Friday.

o2 were going to cap data transfer at 200MB per month, but it’s now going to be unlimited:

”So we’ve taken the decision to remove the fair usage cap so that ‘unlimited’ really does mean ‘unlimited’ – this is a market first.”

Data accessed must be for personal, not commercial, use and the phone must not be used as a modem.

Sounds great to me! :) And to think i used to be a very vocal anti-mac fanboy ;)