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

intro to arduino
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Intro to Arduino

Akiba FreakLabs, Tokyo Hackerspace

slide-2
SLIDE 2

Traditional embedded

  • What makes embedded development difficult?

– Build tools – Software internals – Non standard hardware

slide-3
SLIDE 3

Arduino

  • Why Arduino

– Cheap – Standardized hardware – Vast libraries – Easy to program devices – Very active community

slide-4
SLIDE 4

Arduino IDE

slide-5
SLIDE 5

Arduino Hardware

  • Standardized
  • Open source
  • Many variants
slide-6
SLIDE 6

Arduino Pins

slide-7
SLIDE 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

slide-8
SLIDE 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

slide-9
SLIDE 9

Lab 3 - Fade

  • delay(time)

– blocking delay in msec – time = msec

slide-10
SLIDE 10
  • Hardware connection

– Red = 5V – Black = GND – White = control -> goes to pin 9

Lab 4 – Servo Motor

slide-11
SLIDE 11

Lab 4 – Servo Motor

  • Servo myservo

– Creates servo object – Object has actions that can be accessed

  • myservo.attach

– specifies which pin servo is

  • n
  • myservo.write(pos)

– value btw 0 and 180 specifies servo position

slide-12
SLIDE 12

Lab 5 – Temperature Sensor

  • Hardware connections

– Vin = 5V – GND = GND – Vout to Analog 0

  • img/code from adafruit
slide-13
SLIDE 13
  • 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

Lab 5 – Temperature Sensor