Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Arduino Boot Camp Pitch Slides

1,070 views

Published on

http://arduinobootcamp.xyz

Published in: Education
  • Hello! Who wants to chat with me? Nu photos with me here http://bit.ly/helenswee
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Arduino Boot Camp Pitch Slides

  1. 1. Arduino Boot Camp! Not your usual basic Arduino workshop!
  2. 2. Hello! I am Mithi!
  3. 3. I graduated from BS Electronics and Communication Engineering in UP Diliman sometime ago I am also one of the co-founders of Nanica.io, a young and small robotics education start-up. Hello! I am Mithi!
  4. 4. Here are a few things we do at Nanica.io (it’s video time, guys!)
  5. 5. Our most recent project is Arduino Boot Camp: A Different Approach!
  6. 6. I designed it with <3 (love) for beginners and intermediate Arduino users
  7. 7. You can find it at: http:// ArduinoBootCamp.xyz
  8. 8. It’s NOT your usual Basic Arduino Workshop >_<
  9. 9. How?
  10. 10. Well, let me give you an example.
  11. 11. Usually, in beginner workshops, you are taught the following:
  12. 12. ONE:How to blink an LED
  13. 13. TWO:How to blink an LED without delay()
  14. 14. THREE:How to make a breathing LED
  15. 15. FOUR:How to sweep a servo back and forth
  16. 16. FIVE:How to light an LED with a debounced button
  17. 17. This is how the official Arduino website teaches you how to blink an LED...
  18. 18. digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second
  19. 19. We help you learn how you can do this instead:
  20. 20. led.Toggle(); delay(1000);
  21. 21. This is how the official Arduino website teaches you how to blink an LED without delay()...
  22. 22. unsigned long currentMillis = millis(); if(currentMillis - previousMillis >= interval) { previousMillis = currentMillis; if (ledState == LOW) ledState = HIGH; else ledState = LOW; digitalWrite(ledPin, ledState); }
  23. 23. We help you learn how you can do this instead:
  24. 24. if(metronome.Tick()) led.Toggle();
  25. 25. This is how the official Arduino website teaches you how to make a breathing LED...
  26. 26. int fadeValue; for(fadeValue=0; fadeValue<=255; fadeValue+=5) { analogWrite(ledPin, fadeValue); delay(30); } for(fadeValue=255; fadeValue>=0; fadeValue-=5) { analogWrite(ledPin, fadeValue); delay(30); }
  27. 27. We help you learn how you can do this instead:
  28. 28. led.Set(sweeper.Next(metronome.Tick()));
  29. 29. This is how the official Arduino website teaches you how to sweep a servo...
  30. 30. for (pos = 0; pos <= 180; pos += 1) { servo.write(pos); delay(15); } for (pos = 180; pos >= 0; pos -= 1) { servo.write(pos); delay(15); }
  31. 31. We help you learn how you can do this instead:
  32. 32. servo.write(sweeper.Next(metronome.Tick()));
  33. 33. This is how the official Arduino website teaches you how to light an LED with a debounced button...
  34. 34. int reading = digitalRead(buttonPin); if (reading != lastButtonState) { lastDebounceTime = millis(); } if ((millis() - lastDebounceTime) > debounceDelay) { if (reading != buttonState) { buttonState = reading; if (buttonState == HIGH) ledState = !ledState; } } digitalWrite(ledPin, ledState); lastButtonState = reading;
  35. 35. We help you learn how you can do this instead:
  36. 36. button.Pressed() ? led.On() : led.Off();
  37. 37. Basically, it’s different because it emphasizes the following things immediately:
  38. 38. ONE: CLEAN READABLE CODE
  39. 39. TWO: BASIC OBJECT- ORIENTED DESIGN
  40. 40. THREE: REDUCED USAGE OF delay()so you can multi-task anytime.
  41. 41. BUT HOW DO YOU DO THAT????!?
  42. 42. The obvious message here is how you can use the power of OOP design thinking...
  43. 43. ... to abstract implementation details...
  44. 44. ... so that you can focus at the things you want to do.
  45. 45. You get the beneficial side-effects as well:
  46. 46. Code that is easy to understand.
  47. 47. Code that is easy to debug.
  48. 48. Code that is multi- tasking ready.
  49. 49. Code that is scalable. Easily add as many buttons and LEDs as the Arduino can allow.
  50. 50. Code that allows more complex behavior. Add more features and functions without overwhelming yourself.
  51. 51. BUT… HOW DO YOU DO THAT EXACTLY ????!?
  52. 52. The first step is to identify the OBVIOUS objects
  53. 53. LED, BUTTON, and SERVO (the Arduino already has a built-in servo class in one of its libraries)
  54. 54. DigitalOutput led; led.New(int pin); led.On(); led.Off(); led.Toggle(); led.Set(int brightness);
  55. 55. Button button; button.New(pin, debounceTime); bool state = button.Pressed();
  56. 56. The next step is to identify not so obvious objects
  57. 57. sweeper.New(x1, x2, inc, type); sweeper.Next(0/1); // type = BACKANDFORTH/NORMAL /* if 0, returns current state ** if 1, updates to and return ** next state */
  58. 58. metronome.New(milliSeconds) bool hasTicked= metronome.Tick()
  59. 59. You can use sweeper in myriad applications… not just servos and LEDs...
  60. 60. You can use this to toggle buttons, play tunes, do countdowns...
  61. 61. and even do away with long subroutines because of for-loops.
  62. 62. Using metronome instead of delay(), you get a more readable code that’s even multi-tasking ready.
  63. 63. You can even sweep multiple servos….
  64. 64. ...blink and sweep multiple LEDs...
  65. 65. ...(simultaneously, and at different rates )...
  66. 66. ...while catching as many buttons as you wish...
  67. 67. ...without making your code a nightmare.
  68. 68. You can even sweep multiple servos, blink and sweep multiple LEDs, (simultaneously, at different rates) while catching as many buttons as you wish, without making your code a nightmare.
  69. 69. Awesome right?!!
  70. 70. There’s more where that came from!
  71. 71. Again, check it out! http:// ArduinoBootCamp.xyz
  72. 72. But wait...
  73. 73. ...what about performance?
  74. 74. Only sacrifice readability for performance if you have measured that your code is too slow for its intended use.
  75. 75. Correct. Beautiful. Fast. (in that order) -Elliot Rusty Harold
  76. 76. Premature optimization is the root of all evil. -Sir Tony Hoare
  77. 77. I hope to dispel the myth that fast code must be illegible ugly code... -Elliot Rusty Harold
  78. 78. ...improvement in beauty can also lead to improvement in speed. -Elliot Rusty Harold
  79. 79. Hope you join our Arduino Boot Camp!!
  80. 80. One more thing though: My code is not God ;)
  81. 81. Again, hope you join our Arduino Boot Camp!!
  82. 82. And thank you for listening! :)

×