intro to arduino
play

Intro to Arduino Akiba FreakLabs, Tokyo Hackerspace Traditional - PowerPoint PPT Presentation

Intro to Arduino Akiba FreakLabs, Tokyo Hackerspace Traditional embedded What makes embedded development difficult? Build tools Software internals Non standard hardware Arduino Why Arduino Cheap Standardized


  1. Intro to Arduino Akiba FreakLabs, Tokyo Hackerspace

  2. Traditional embedded • What makes embedded development difficult? – Build tools – Software internals – Non standard hardware

  3. Arduino • Why Arduino – Cheap – Standardized hardware – Vast libraries – Easy to program devices – Very active community

  4. Arduino IDE

  5. Arduino Hardware • Standardized • Open source • Many variants

  6. Arduino Pins

  7. Lab 1 – Hello World • Serial.begin(speed) – initializes serial port at given speed • Serial.print(string) – prints string • Serial.println(string) – prints string + trailing newline

  8. Lab 2 – Blink • pinMode(pin, dir) – pin = pin number – dir = INPUT or OUTPUT • digitalWrite(pin, val) – pin = pin number – val = LOW or HIGH or 0 or 1 • analogWrite(pin, val) – pin = pin number – val = 0 to 255 – uses PWM – only for certain pins

  9. Lab 3 - Fade • delay(time) – blocking delay in msec – time = msec

  10. Lab 4 – Servo Motor • Hardware connection – Red = 5V – Black = GND – White = control -> goes to pin 9

  11. Lab 4 – Servo Motor • Servo myservo – Creates servo object – Object has actions that can be accessed • myservo.attach – specifies which pin servo is on • myservo.write(pos) – value btw 0 and 180 specifies servo position

  12. Lab 5 – Temperature Sensor • Hardware connections – Vin = 5V – GND = GND – Vout to Analog 0 • img/code from adafruit

  13. Lab 5 – Temperature Sensor • analogRead(pin) – returns analog value btw 0 & 1023 – if using 5V supply as ref, full scale (1023) corresponds to 5V – voltage conversion (val / 1023) * 5V

Recommend


More recommend