Physical Computing with the Arduino platform and Ruby

2,603 views

Published on

A presentation given to the Orlando Ruby User\'s Group as well as the Orlando Linux User\'s Group on physical computing with the Arduino platform while utilizing the Ruby library RAD for writing the code.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,603
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
65
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Physical Computing with the Arduino platform and Ruby

  1. 1. Physical Computing with Ruby and Arduino Matthew Williams @mwilliams Orlando Linux Users Group
  2. 2. Barcamp Orlando Anyone?
  3. 3. What's Arduino? http://www.arduino.cc
  4. 5. Arduino <ul><ul><li>14 Digital I/O (6 PWM) </li></ul></ul><ul><ul><li>6 Analog In </li></ul></ul><ul><ul><li>16kb Flash Memory </li></ul></ul><ul><ul><ul><li>2kb for boot loader </li></ul></ul></ul><ul><ul><li>16MHz Clock Speed </li></ul></ul><ul><ul><li>Serial Communication </li></ul></ul><ul><ul><li>USB Powered (or AC) </li></ul></ul><ul><ul><li>I2C </li></ul></ul>
  5. 6. Arduino haz Flavor?
  6. 12. http://rad.rubyforge.org/ http://github.com/atduskgreg/rad/
  7. 13. Arduino IDE
  8. 14. RAD IDE
  9. 15. Ruby + Physical Computing <ul><ul><li>Control an Arduino with Ruby </li></ul></ul><ul><ul><ul><li>RubyToC </li></ul></ul></ul><ul><ul><ul><li>AVR-GCC </li></ul></ul></ul><ul><ul><li>Most of the Arduino API ported to Ruby </li></ul></ul><ul><ul><li>Additional libraries </li></ul></ul><ul><ul><ul><li>Serial communications </li></ul></ul></ul><ul><ul><ul><li>Servos </li></ul></ul></ul>
  10. 16. Arduino Code <ul><li>int ledPin = 13; </li></ul><ul><li>void setup() { </li></ul><ul><li>pinMode(ledPin, OUTPUT); </li></ul><ul><li>} </li></ul><ul><li>void loop() { </li></ul><ul><li>digitalWrite(ledPin, HIGH); </li></ul><ul><li>delay(1000); </li></ul><ul><li>digitalWrite(ledPin, LOW); </li></ul><ul><li>delay(1000); </li></ul><ul><li>} </li></ul>
  11. 17. RAD Code <ul><li>class HelloWorld < ArduinoSketch </li></ul><ul><li>output_pin 7, :as => :led </li></ul><ul><li>def loop </li></ul><ul><li>blink led, 1000 </li></ul><ul><li>end </li></ul><ul><li>end </li></ul>
  12. 18. RAD Methods <ul><ul><li>input_pin(s) </li></ul></ul><ul><ul><li>output_pin(s) </li></ul></ul><ul><ul><li>digitalWrite| digitalRead </li></ul></ul><ul><ul><li>analogWrite | analogRead </li></ul></ul><ul><ul><li>serial_print | serial_read </li></ul></ul><ul><ul><li>Keeping it simple </li></ul></ul><ul><ul><ul><li>It's all about the hardware </li></ul></ul></ul>
  13. 19. Coming Soon <ul><ul><li>Testing </li></ul></ul><ul><ul><li>Arduino Simulator </li></ul></ul><ul><ul><li>Better RubyToC Support </li></ul></ul><ul><ul><li>More &quot;Out of the Box Support&quot; </li></ul></ul><ul><ul><ul><li>LCD's </li></ul></ul></ul><ul><ul><ul><li>OLED Displays </li></ul></ul></ul><ul><ul><ul><li>Motors </li></ul></ul></ul>
  14. 20. Arduino Shields http://www.nycresistor.com/2008/04/21/zach-smith-demos-his-danger-shield/
  15. 24. http://www.liquidware.com/projects/8/Pin+Visualizer
  16. 25. Buy an Arduino http://www.sparkfun.com http://ww.makezine.com $34.95 (or cheaper)
  17. 26. Awesome Resources <ul><ul><li>http://makezine.com/getstartedarduino/ </li></ul></ul><ul><ul><li>http://blog.makezine.com/archive/arduino/ </li></ul></ul><ul><ul><li>http://arduino.cc/playground </li></ul></ul>
  18. 27. Barduino http://github.com/mwilliams/barduino
  19. 28. The Barduino <ul><ul><li>Arduino </li></ul></ul><ul><ul><li>Breadboard + Wire </li></ul></ul><ul><ul><li>Transistors </li></ul></ul><ul><ul><li>Relays </li></ul></ul><ul><ul><li>Windshield Washer Fluid Pumps </li></ul></ul><ul><ul><li>~$60 Total? </li></ul></ul><ul><ul><li>2 pumps, could handle 14+ </li></ul></ul>
  20. 29. Barduino-tender http://github.com/mwilliams/barduino-tender
  21. 30. Barduino-tender Recipe <ul><li>drink 'Screwdriver' do </li></ul><ul><li>serve_in 'Highball Glass' </li></ul><ul><li>ingredients do </li></ul><ul><li>2.ounces :vodka </li></ul><ul><li>5.ounces :orange_juice </li></ul><ul><li>end </li></ul><ul><li>end </li></ul>
  22. 31. Let's Serve Some Drinks (and look at code)

×