1 / 23

motor procedures

motor procedures. lesson # aar-04 . lesson #4 version 1 (21/02/13) by Jack de Prenter. select software. Select arduino software. lesson #4 version 1 (21/02/13) by Jack de Prenter. select board. Select nano ATmega328. If you select no board or the wrong board the aar-04 do'nt work!!!.

newman
Download Presentation

motor procedures

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. motor procedures lesson # aar-04 lesson #4 version 1 (21/02/13) by Jack de Prenter

  2. select software Select arduino software lesson #4 version 1 (21/02/13) by Jack de Prenter

  3. select board Select nano ATmega328 If you select no board or the wrong board the aar-04 do'nt work!!! lesson #4 version 1 (21/02/13) by Jack de Prenter

  4. select com port You see only the Serial Port when pc is connect to the aar-04 lesson #4 version 1 (21/02/13) by Jack de Prenter

  5. load program Load the example from the CD lesson #4 version 1 (21/02/13) by Jack de Prenter

  6. Examples/_04_move /* Name project: Example 4, RP6 Motor control Author: Egbert Koerhuis Company: Arexx Engineering Discription: This Example Program shows how to control the Motors. Make sure that the AAR can __NOT__ move when uploading the program! After uploading the program, the AAR will wait 2 seconds before the program start. >>> DO NOT FORGET TO REMOVE THE USB CABLE, after uploading the program. ATTENTION: THE ROBOT MOVES AROUND IN THIS EXAMPLE! PLEASE PROVIDE ABOUT 1m x 1m OR MORE FREE SPACE FOR THE ROBOT! You are free to change the code! */ void setup() { //Setup: Initalization pinMode(10, OUTPUT); //pin 10 left foreward pinMode(9, OUTPUT); //pin 9 left backward pinMode(5, OUTPUT); //pin 5 right foreward pinMode(6, OUTPUT); //pin 6 right backward lesson #4 version 1 (21/02/13) by Jack de Prenter

  7. new discription program /* This Example Program shows how to control the Motors with c++ functions. Make sure that the AAR can NOT move when uploading the program! After uploading the program, the AAR will wait 2 seconds before the program start. >>> DO NOT FORGET TO REMOVE THE USB CABLE <<< after uploading the program. ATTENTION THE ROBOT MOVES AROUND IN THIS EXAMPLE! PROVIDE ABOUT 1m x 1m OR MORE FREE SPACE FOR THE ROBOT! You are free to change the code! */ lesson #4 version 1 (21/02/13) by Jack de Prenter

  8. program structure void setup() { initialize input initialize output } void loop() { program instructions } lesson #4 version 1 (21/02/13) by Jack de Prenter

  9. Drive 500ms foreward // set pin 9 to ground // set speed left motor 200 foreward digitalWrite(9,LOW); analogWrite(10,200); // set pin 6 to ground // set speed right motor 200 foreward digitalWrite(5,LOW); analogWrite(6,200); // drive for 5000ms delay(5000); lesson #4 version 1 (21/02/13) by Jack de Prenter

  10. FUNCTION Drive foreward int forward (int ms) { digitalWrite( 9,LOW); // pin 9 to ground analogWrite (10,200); // speed left motor digitalWrite( 5,LOW); // pin 6 to ground analogWrite ( 6,200); // speed right motor delay(ms); // drive for ms } lesson #4 version 1 (21/02/13) by Jack de Prenter

  11. new program structure void setup() { initialize input - output } int function () { instructions } void loop() { program instructions } lesson #4 version 1 (21/02/13) by Jack de Prenter

  12. new loop void loop() { int forward (500); } lesson #4 version 1 (21/02/13) by Jack de Prenter

  13. new loop void loop() { int forward (1000); int righTurn ( 700); int forward (1000); int rightTurn ( 700); int forward (2000); int rightRotate(5000); int wait (1000); } lesson #4 version 1 (21/02/13) by Jack de Prenter

  14. function make a right turn int rightTurn(int ms) { // left motor 200 forward digitalWrite(9,LOW); analogWrite(10,200); // stop right motor digitalWrite(6,LOW); digitalWrite(5,LOW); // turn for ms delay(ms); } experimental ms = 255 turn 45 degrees ms = 500 turn 90 degrees ms = 700 turn 180 degrees lesson #4 version 1 (21/02/13) by Jack de Prenter

  15. function Make a rightrotate int rightRotate(int ms) { // left motor 200 forward digitalWrite( 9,LOW); analogWrite (10,200); // stop right motor digitalWrite(6,LOW); analogWrite (5,LOW); // turn for ms delay(ms); } experimental ms = 240 turn 45 degrees ms = 480 turn 90 degrees ms = 680 turn 180 degrees lesson #4 version 1 (21/02/13) by Jack de Prenter

  16. practice #1 Make a function: • backward() • leftTurn() • leftRotate() • wait() lesson #4 version 1 (21/02/13) by Jack de Prenter

  17. CHIP TUNNING 1/2 Drive foreward int forward (int ms) { digitalWrite( 9,LOW); // pin 9 to ground analogWrite (10,200); // speed left motor digitalWrite( 5,LOW); // pin 6 to ground analogWrite ( 6,200); // speed right motor delay(ms); // drive for ms } lesson #4 version 1 (21/02/13) by Jack de Prenter

  18. chip tunning 2/2 Drive foreward int forward (int ms) { digitalWrite( 9,LOW); // pin 9 to ground analogWrite (10,179); // speed left motor digitalWrite( 5,LOW); // pin 6 to ground analogWrite ( 6,200); // speed right motor delay(ms); // drive for ms } lesson #4 version 1 (21/02/13) by Jack de Prenter

  19. Practice #2 chiptuning function: • forward() • backward() lesson #4 version 1 (21/02/13) by Jack de Prenter

  20. Turn - turn on place turn turn on place lesson #4 version 1 (21/02/13) by Jack de Prenter

  21. practice #3 chiptunning function: • left / right 45 degrees • left / right 90 degrees chiptunning function: • rotate left/right 45 • rotate left/right 90 • rotate left/right 180 lesson #4 version 1 (21/02/13) by Jack de Prenter

  22. motor cheat tabel forward digitalWrite( 9,LOW) analogWrite (10,200) forward digitalWrite(5,LOW) analogWrite (6,200) left motor right motor backward digitalWrite(10,LOW) analogWrite ( 9,200) backward digitalWrite(6,LOW) analogWrite (5,200) lesson #4 version 1 (21/02/13) by Jack de Prenter

  23. practice #4 Let your aar-04 move from A to B More information? JackDePrenter.Wordpress.Com lesson #4 version 1 (21/02/13) by Jack de Prenter

More Related