1 / 12

AAR Workshop 1 Arduino Programming

AAR Workshop 1 Arduino Programming. ubcomechatronics@gmail.com. Objective. Program an arduino to control some LED's. Arduino. Source: http://www.arduino.cc/ http://www.raspberrypi.org/. The Arduino. Arduino Programming Interface.

armine
Download Presentation

AAR Workshop 1 Arduino Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AAR Workshop1 Arduino Programming ubcomechatronics@gmail.com

  2. Objective Program an arduino to control some LED's Arduino Source: http://www.arduino.cc/ http://www.raspberrypi.org/

  3. The Arduino

  4. Arduino Programming Interface • Download and unzip from (~85 Mb): http://arduino.cc/en/Main/Software • Stand-alone application

  5. Setting up Communication Select your Board type "Arduino Nano" Select where which port you connect the Arduino on

  6. Quick Programming Intro • Variable Types: int, char, double, float • function structure: void setup() { Code here } void loop() { Code here }

  7. Structure of an Arduino Program Declare and Initialize variables The Setup() function runs once, when the arduino is turned on, Select and Initialize the pinMode as either an Input pin or an output pin the loop() function loops repeatedly.

  8. Important functions pinMode(int PinNumber, [INPUT|OUTPUT]) • Assigns an arduino pin as an input or output digitalWrite(int PinNumber, [LOW|HIGH]) • Sets a pin low or high analogWrite(int PinNumber, int Value [0-255]) • Sets the duty cycle for a pin

  9. Pulse Width Modulation on Arduino PWM capable pins designated by tilde "~" - #11, 10,9, 6,5,3 on the uno - #3,5,6,9,10,11 on the nano

  10. AnalogWrite Function

  11. Your Basic Blink LED Example Loads of examples to get you started.

  12. Programming Tasks 1) Blink LED 2) 2 LED Blink 4) 4 LED Sweep 5) 4 LED Progressive Brightness Tips: - Make separate functions to control speeds of blinking - Remember to make meaningful variable names!

More Related