coma study room vol.2 arduino workshop

50
coma Study Room 2014.03.22 @BULLET’S presented by coma team Arduino Workshop おもちゃハック ~動くものをつくろう!~ coma team Eto Haruhiko 1. イントロダクション 2. Arduinoとは 3. DCモーターことはじめ 4. サーボモーターことはじめ 5. 応用例 6. 実用に向けてのTips

Upload: eto-haruhiko

Post on 30-May-2015

2.058 views

Category:

Self Improvement


0 download

DESCRIPTION

coma Study Room vol.2 3.22(Sat) 18:00-22:30@Bullet’s http://coma.io/coma-study-room-vol-2/

TRANSCRIPT

  • 1. coma Study Room!! 2014.03.22! @BULLETS! presented by coma team Arduino! Workshop! ! ! ! coma team Eto Haruhiko 1.! ! ! ! ! ! ! 2. ! Arduino! ! ! ! ! ! ! 3.! DC! ! ! ! ! ! ! 4.! ! ! ! ! 5.! ! 6.! Tips! ! ! ! ! !

2. 1.!! 3. coma coma=communication art project Webhttp://coma.io/! ! Technology! ! ! 1Bullets comaDiscotheque coma Study Room coma Creators Session 4. coma Study Room vol.1 Arduino Processing +Arduino PC RGB-LED ! comaDiscothequeVer0.02comakuma comakuma comahttp://coma.io/ 5. ! ArduinoDC 6. ! ! ! ! ! ! Arduino PC ! ! ! ! ! etc. ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 7. 2.!! Arduino 8. Arduino! ! ! ! C/C++Arduino! ! ! PC! ! 9. Arduino! ! ! USBIDE! ! ! Arduino! ! ! Arduino Uno! ! ! ! ! 10. PWM05V LED 5V3.3V 5V OK USB 5V Arduino Uno 11. 3.!! DC 12. DC ! 13. ArduinoDC ArduinoDC40mA FA-130RA http://www.mabuchi-motor.co.jp/en_US/cat_les/fa_130ra.pdf 0.15A=150mA 0.56A=560mA () ArduinoArduino 14. Arduino Arduino Arduino Arduino 15. TA7267BP Vcc618VArduino5V Arduino ! IN1IN2HIGH/LOW PWMPWM PWMTA7291Phttp://akizukidenshi.com/catalog/g/gI-02001/ QTA7291PA 1 2 3 4 5 6 7 http://akizukidenshi.com/download/ta7267bp.pdf Arduino 5V 2 Arduino Arduino 16. or ! ! ! 1 ! 1 17. (+)! ! 3.3V5V 18. PWM 56 Arduino Arduino 24OK DC FA-130RARE-260RA TA7267BP with 19. PWM 56 Arduino FA-130RARE-260RA TA7267BP with 20. USB! ArduinoPC! 21. 4 voidsetup(){ } voidloop(){ // digitalWrite(5,HIGH); digitalWrite(6,LOW); delay(1000);//1 // digitalWrite(5,HIGH); digitalWrite(6,HIGH); delay(1000);//1 // digitalWrite(5,LOW); digitalWrite(6,HIGH); delay(1000);//1 // digitalWrite(5,LOW); digitalWrite(6,LOW); delay(1000);//1 } dcmotor_1.ino 4 Arduino IDE degitalWrite(HIGHLOW)! HIGH = 5VLOW = 0V 1000.1 22. (1) ! ! ! Arduino ! 23. (2) ! Arduino ! UnoUno Nanonano w/ATmega328 LeonardoLeonardo MicroMicro ! ! 24. voidsetup(){ } voidloop(){ //MAX analogWrite(5,255); digitalWrite(6,LOW); delay(1000);//1 // digitalWrite(5,HIGH); digitalWrite(6,HIGH); delay(1000);//1 // analogWrite(5,128); digitalWrite(6,LOW); delay(1000);//1 // digitalWrite(5,LOW); digitalWrite(6,LOW); delay(1000);//1 } ! ! dcmotor_2.ino 2 ArduinoPWM! analogWrite(0255)! 0255256LED 25. Processing intspeed; voidsetup(){ Serial.begin(9600);//9600bps } voidloop(){ // if(Serial.available()>0){ speed=Serial.read();//speed analogWrite(6,speed);//=speed digitalWrite(5,LOW); } } ! ! Arduino dcmotor_3.ino Processing ProcessingGUI importprocessing.serial.*;// SerialmyPort; // intArduinoPortNum=5; // intspeed; // voidsetup(){ frameRate(30); //30fps size(255,300); // println(Serial.list()); // //ArduinoPortNum9600bps myPort=newSerial(this,Serial.list()[ArduinoPortNum],9600); } voiddraw(){ background(100,250,250); stroke(255); line(0,235,250,235); //X speed=mouseX; // fill(0,110,220); ellipse(mouseX,235,10,10); // textAlign(CENTER,CENTER); text("speed",width/2,80); text(speed,width/2,100); // myPort.write(speed); } ! ! ! Processing dcmotorController.pde Arduino ! http://coma.io/coma-study-room-vol-1/ 26. 4.!! 27. RC 0180 213 DC ! RC ! ! 28. 1Arduino DC + - Arduino 2 RC5V 23V Arduino(-) 29. RC #include // Servoservo0; // /* Servoservo1; //2 Servoservo2; //3 */ voidsetup(){ servo0.attach(2); //2 } voidloop(){ servo0.write(90); //0180 } ! ! Servo_1.ino 1 Arduino IDE Servo0180 #include// Servoservo0;// voidsetup(){ servo0.attach(2);//2 } voidloop(){ servo0.write(90);//90 delay(500);//500 servo0.write(180);//180 delay(500);//500 servo0.write(0);//0 delay(500);//500 } ! ! Servo_2.ino 30. Processing #include // Servoservo0; //servo0 intdeg; //deg voidsetup(){ servo0.attach(2); //2 Serial.begin(9600);//9600bps } voidloop(){ // if(Serial.available()>0){ deg=Serial.read();//deg servo0.write(deg);//deg } } ! ! DC importprocessing.serial.*; // SerialmyPort; // intArduinoPortNum=5; // intdegree; // voidsetup(){ frameRate(30); //30fps size(220,300); // println(Serial.list());// //ArduinoPortNum9600bps myPort=newSerial(this,Serial.list()[ArduinoPortNum],9600); } voiddraw(){ background(100,250,250); stroke(255); line(0,235,250,235); fill(0,110,220); textAlign(CENTER,CENTER); text("degree",width/2,80); // if(20