Your SlideShare is downloading. ×
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Mao arduino
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Mao arduino

615

Published on

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
615
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
21
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 阿爾杜伊諾 Arduino: Lv. 1 2014.5.2 Mutienliao.com MAO Sunday, May 4, 14
  • 2. Sunday, May 4, 14
  • 3. Sunday, May 4, 14
  • 4. Arduino Introduction Sunday, May 4, 14
  • 5. What is Arduino? Sunday, May 4, 14
  • 6. Arduino Hardware Arduino Software Open Source Physical Computing Platform & Group Sunday, May 4, 14
  • 7. • 14 Digital Pins 0-13 • Digital Pins 0-1/Serial In/Out - TX/RX - Serial port Pin 0,1. • 6 Analog Input Pins A0-A5 • Analog Output * (Digital Pins 3,5,6,9,10,11) • Reset - S1 • • Jumper USB DC (Duemilanove ) • USB • Vin, 5V, 3.3V (Diecimila ) Sunday, May 4, 14
  • 8. 各式各樣的Arduino........族繁不及備載 Sunday, May 4, 14
  • 9. Digital Out Digital In Analog In Analog Out Communication Sunday, May 4, 14
  • 10. Digital Out Sunday, May 4, 14
  • 11. Analog Out Sunday, May 4, 14
  • 12. Digital In Sunday, May 4, 14
  • 13. Analog In Sunday, May 4, 14
  • 14. Communication Sunday, May 4, 14
  • 15. Digital In Digital Out Analog In Analog Out Communication Emotion Experience Sunday, May 4, 14
  • 16. Getting started w/ Arduino on your Computer Sunday, May 4, 14
  • 17. 1 | Get an Arduino & USB cable Sunday, May 4, 14
  • 18. | Prepare to test Arduino board - Arduino - LED Blink File > Examples > Basic > Blink Sunday, May 4, 14
  • 19. | Set up your board • : Tools > Board [ Mac OS X ] [ Mac OS X ] • Arduino serial port: Tools > Serila Port Mac /dev/tty.usbserial- * [ Windows ] [ Windows ] Sunday, May 4, 14
  • 20. | Upload the program Vertify Update to board* * Arduino NG Reset Update Arudino Reset Reset Update TX/RX LED 2~3 Pin13 pin ( ) • File > Examples > Basic > Blink • • .... Sunday, May 4, 14
  • 21. # | Troubleshooting • Serial port • • Serial Port Serila port • Jump Duemilanove/UNO • Reset Reset Update • Arudino USB • Sunday, May 4, 14
  • 22. (Voltage) (Current) Sunday, May 4, 14
  • 23. • • LED LED ( ) • LED • LED ( ) Digital Outupt Circuit Sunday, May 4, 14
  • 24. Digital Outupt Circuit Sunday, May 4, 14
  • 25. Digital Outupt Circuit Sunday, May 4, 14
  • 26. breadborad Sunday, May 4, 14
  • 27. breadborad Sunday, May 4, 14
  • 28. Digital Out Digital Out Sunday, May 4, 14
  • 29. #1 | Blink Sunday, May 4, 14
  • 30. • Only 1 or 0 / High or LOW / ON or OFF HIGH LOW 1 0 Sunday, May 4, 14
  • 31. int ledPin = 13; // LED connected to digital pin 3 void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second } pinMode(pin, Mode) digitalWrite(pin, value) delay(ms) #1 File > Examples > Basic > Blink Sunday, May 4, 14
  • 32. LED pin ? ( ) pin? pinMode(who, ?) ( ) digitalWrite(who,?) Sunday, May 4, 14
  • 33. 輸入才是互動的精華 Sunday, May 4, 14
  • 34. Digital Input Digital In Sunday, May 4, 14
  • 35. #6 | Button Sunday, May 4, 14
  • 36. #6 | Button #6 File > Examples > Digital > Button Sunday, May 4, 14
  • 37. const int buttonPin = 2; // the number of the pushbutton pin const int ledPin = 13; // the number of the LED pin int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } } #6 File > Examples > Digital > Button Sunday, May 4, 14
  • 38. Sunday, May 4, 14
  • 39. #7 | StateChangDetection #7 File > Examples > Digital > StateChangDetection Sunday, May 4, 14
  • 40. Analog Out Analog Out Sunday, May 4, 14
  • 41. Analog Output PWM (Pulse Width Modulation) ( 0~5V) OutputVoltage = High_time(%) * Max_Voltage Arduino PWM pin 3,5,6,9,10,11 Sunday, May 4, 14
  • 42. Arduino PWM pin 3,5,6,9,10,11 0~5V 0~255 analogWrite( pin, val ) Sunday, May 4, 14
  • 43. #4 | Fade #4 File > Examples > Basic > Fade Sunday, May 4, 14
  • 44. int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by void setup() { // declare pin 9 to be an output: pinMode(9, OUTPUT); } void loop() { // set the brightness of pin 9: analogWrite(9, brightness); // change the brightness for next time through the loop: brightness = brightness + fadeAmount; // reverse the direction of the fading at the ends of the fade: if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount ; } // wait for 30 milliseconds to see the dimming effect delay(30); } #4 File > Examples > Basic > Fade Sunday, May 4, 14
  • 45. Servo Sunday, May 4, 14
  • 46. 伺服馬達跟DC馬達比較不同,DC馬達是供電就不停地轉動,而伺服馬達是透過PWM訊號供給的 時間長短來決定,而伺服馬達有分兩種: (1) 360度不停轉的,會依照PWM時間長短,決定轉動快慢與轉動方向 (2) 定角度的,會依照PWM時間長短,在0~180度角間,精準地控制要擺到那個角度 Sunday, May 4, 14
  • 47. 坊間買得到的伺服馬達會有兩種顏色配對的接線: (紅.黑.白)~ 對應 V+. GND . 訊號pin (紅.棕.橘)~ 對應 V+. GND . 訊號pin # File> Example> Servo> Sweep Sunday, May 4, 14
  • 48. 輸入才是互動的精華 Sunday, May 4, 14
  • 49. Analog Input Analog In Sunday, May 4, 14
  • 50. Potentiometer Sunday, May 4, 14
  • 51. Photocell get value get value get value Sunday, May 4, 14
  • 52. Arduino A0~A5 0~5V 0~1023 analogRead( pin ) Sunday, May 4, 14
  • 53. #10 | analog_control #10 http://code.mutienliao.tw/arduino/analog_control.pde Sunday, May 4, 14
  • 54. int ledPin = 13; // LED connected to digital pin 13 int analogPin = 0; // photocell connected to analog pin 0 int val = 0; void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { val = analogRead(analogPin); // read the value from the sensor if(val<80) { digitalWrite(ledPin, HIGH); // sets the LED on } else { digitalWrite(ledPin, LOW); // sets the LED off } delay(50); } #10 http://code.mutienliao.tw/arduino/analog_control.pde Sunday, May 4, 14
  • 55. int ledPin = 13; // LED connected to digital pin 13 int analogPin = 0; // photocell connected to analog pin 0 int val = 0; void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output Serial.begin(9600); } void loop() { val = analogRead(analogPin); // read the value from the sensor Serial.println(val); if(val<80) { digitalWrite(ledPin, HIGH); // sets the LED on } else { digitalWrite(ledPin, LOW); // sets the LED off } delay(50); } #10 analogRead #10 http://code.mutienliao.tw/arduino/analog_control.pde Sunday, May 4, 14
  • 56. Arduino Software Serial Monitor Arduino 546756456575456745674567447 baud rate Sunday, May 4, 14
  • 57. #11 | AnalogInOutSerial #11 File > Examples > Analog > AnalogInOutSerial Sunday, May 4, 14
  • 58. const int analogInPin = A0; // Analog input pin that the potentiometer is attached to const int analogOutPin = 9; // Analog output pin that the LED is attached to int sensorValue = 0; // value read from the pot int outputValue = 0; // value output to the PWM (analog out) void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); } void loop() { // read the analog in value: sensorValue = analogRead(analogInPin); // map it to the range of the analog out: outputValue = map(sensorValue, 0, 1023, 0, 255); // change the analog out value: analogWrite(analogOutPin, outputValue); // print the results to the serial monitor: Serial.print("sensor = " ); Serial.print(sensorValue); Serial.print("t output = "); Serial.println(outputValue); // wait 10 milliseconds before the next loop // for the analog-to-digital converter to settle // after the last reading: delay(10); } #11 File > Examples > Analog > AnalogInOutSerial Sunday, May 4, 14
  • 59. Communication Communication Sunday, May 4, 14
  • 60. Arduino USB RS-232 Serial HIGH / LOW Serial port Arduino C/C++,VB, MAX/MSP,VVVV, Processing FLASH( ) Sunday, May 4, 14
  • 61. #12 | PC to Arduino #12 File > Example > Communication > PhysicalPixel Sunday, May 4, 14
  • 62. RGB Sunday, May 4, 14
  • 63. RGB LED Sunday, May 4, 14
  • 64. RED 5V Blue Green LED Sunday, May 4, 14
  • 65. Arduino pin 9 5V pin 10 pin 11 RED Blue Green #13 http://code.mutienliao.tw/arduino/common_anode_RGB.pde #13 http://code. mutienliao.tw/arduino/Serial_common_anode_RGB.ino Sunday, May 4, 14
  • 66. #13 http://code.mutienliao.tw/arduino/common_anode_RGB.pde #13 http://code. mutienliao.tw/arduino/Serial_common_anode_RGB.ino Sunday, May 4, 14
  • 67. RGB sensor Sunday, May 4, 14
  • 68. VCC S1 S0 LED GND VCC S3 S2 OUT GND 5V pin 7 pin 6 GND pin 5 pin 4 pin 3 [Arduino] http://code.mutienliao.tw/arduino/LightSensing_Simple.ino Sunday, May 4, 14
  • 69. [Arduino] http://code.mutienliao.tw/arduino/LightSensing_showcolor.ino [Processing] http://code.mutienliao.tw/processing/show_color.pde Sunday, May 4, 14

×