I’ve made a few modifications to my Arduino sketch to keep it small… and I’m happy with it! I’ve learnt that the smaller the footprint on a device with limited memory the faster it can process things. So I’ve gone from an Arduino Sketch of roughly 100 lines of code… to something so slim and simple that it almost feels wrong to use it! Below is the graph from the output of the serial socket…

I’m releasing this code… now… I’m feeling a little nervous about releasing it… If you’re going to copy and paste this code, could you please at least leave the credit at the top? I’ve worked hard on this, and I didn’t do it so some twat can steak his claim on my work!

That’s right, no advanced algorithms, no crazy conversions, I’m just taking the first 3 bytes of the buffer from the socket and assigning it to the acceleration, and the last 3 bytes and assigning it to the steering… There are no heavy HTTP protocols to handle the requests, just one socket stream connection from the iPhone to the Arduino/BlackWidow! I can’t believe that the last 4 months of R&D has led to 8 lines of code!

Just to show you what I mean, the sketch started out like this…

Which works fine if you’re not trying to push through 60 requests per second to a device with 2 KB of SRAM and 1 KB of EEPROM. Just to put it into perspective the iPhone 3GS has 256mb’s of RAM…

Update… sorry guys, I’ve taken the code down… for now! I’ll put it back up once I’ve made my mind up about how to distribute it!

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • LinkedIn
  • MySpace
  • RSS
  • StumbleUpon
  • Technorati