{"action":"created","issue":{"url":"https://api.github.com/repos/rwaldron/johnny-five/issues/970","labels_url":"https://api.github.com/repos/rwaldron/johnny-five/issues/970/labels{/name}","comments_url":"https://api.github.com/repos/rwaldron/johnny-five/issues/970/comments","events_url":"https://api.github.com/repos/rwaldron/johnny-five/issues/970/events","html_url":"https://github.com/rwaldron/johnny-five/issues/970","id":119220669,"number":970,"title":"Arduino tank controlling two dc motors with L298n but servo motor is not working properly","user":{"login":"EmilLipovsek","id":16049324,"avatar_url":"https://avatars.githubusercontent.com/u/16049324?v=3","gravatar_id":"","url":"https://api.github.com/users/EmilLipovsek","html_url":"https://github.com/EmilLipovsek","followers_url":"https://api.github.com/users/EmilLipovsek/followers","following_url":"https://api.github.com/users/EmilLipovsek/following{/other_user}","gists_url":"https://api.github.com/users/EmilLipovsek/gists{/gist_id}","starred_url":"https://api.github.com/users/EmilLipovsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmilLipovsek/subscriptions","organizations_url":"https://api.github.com/users/EmilLipovsek/orgs","repos_url":"https://api.github.com/users/EmilLipovsek/repos","events_url":"https://api.github.com/users/EmilLipovsek/events{/privacy}","received_events_url":"https://api.github.com/users/EmilLipovsek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-27T16:25:53Z","updated_at":"2015-11-27T18:44:32Z","closed_at":null,"body":"I made a Bluetooth controlling Arduino Tank, with two DC motors, and one servo for the turret witch is holding a laser. But the issue is that when I putted \"myservo.attach(4)\", left motor stops working. I checked the code( if I putted the same pin somewhere) and I looked at the pins and all the wires( if I connected something wrong), but I can not see the issue. Please help me. \r\nHere is the code I used without servo(working): \r\n\r\n```ino\r\n#define trigPin 13\r\n#define echoPin 12\r\nchar junk;\r\nString inputString=\"\";\r\nint enA = 10;\r\nint in1 = 9;\r\nint in2 = 8;\r\n// motor two\r\nint enB = 5;\r\nint in3 = 7;\r\nint in4 = 6;\r\nint ledPin1 = 3;\r\nint laserPin2 = 11;\r\nvoid setup() {\r\n  pinMode(11, OUTPUT);\r\n  pinMode(3, OUTPUT);\r\n  pinMode(trigPin, OUTPUT);\r\n  pinMode(echoPin, INPUT);\r\n  Serial.begin(9600);\r\n  pinMode(enA, OUTPUT);\r\n  pinMode(enB, OUTPUT);\r\n  pinMode(in1, OUTPUT);\r\n  pinMode(in2, OUTPUT);\r\n  pinMode(in3, OUTPUT);\r\n  pinMode(in4, OUTPUT);\r\n}\r\n\r\nvoid loop() \r\n{\r\n      long duration, distance;\r\n  digitalWrite(trigPin, LOW);  \r\n  delayMicroseconds(2); \r\n  digitalWrite(trigPin, HIGH);\r\n  delayMicroseconds(10); \r\n  digitalWrite(trigPin, LOW);\r\n  duration = pulseIn(echoPin, HIGH);\r\n  distance = (duration/2) / 29.1;\r\n  if(distance < 20)\r\n  {\r\n  digitalWrite(in1, LOW);\r\n  digitalWrite(in2, LOW);  \r\n  digitalWrite(in3, LOW);\r\n  digitalWrite(in4, LOW);\r\n  delay(2000);\r\n  digitalWrite(in1, LOW);\r\n  digitalWrite(in2, HIGH);  \r\n  digitalWrite(in3, LOW);\r\n  digitalWrite(in4, HIGH);\r\n  delay(500);\r\n  digitalWrite(in1, HIGH);\r\n  digitalWrite(in2, LOW);\r\n  analogWrite(enA, 200);\r\n  digitalWrite(in3, LOW);\r\n  digitalWrite(in4, LOW);\r\n  analogWrite(enB, 200);\r\n  delay(500);\r\n  digitalWrite(in1, HIGH);\r\n  digitalWrite(in2, LOW);\r\n  analogWrite(enA, 200);\r\n  digitalWrite(in3, HIGH);\r\n  digitalWrite(in4, LOW);\r\n  analogWrite(enB, 200);\r\n  }\r\nif(Serial.available()){\r\n    while(Serial.available())\r\n    {\r\n      char inChar = (char)Serial.read(); //read the input\r\n      inputString += inChar;        //make a string of the characters coming on serial\r\n    }\r\n    Serial.println(inputString);\r\n    while (Serial.available() > 0)  \r\n    { junk = Serial.read() ; } \r\n    if(inputString == \"a\"){        \r\n      digitalWrite(in1, HIGH); \r\n      digitalWrite(in2, LOW); \r\n      analogWrite(enA, 200);\r\n      digitalWrite(in3, HIGH);\r\n      digitalWrite(in4, LOW);\r\n      analogWrite(enB, 200); \r\n    }\r\n        if(inputString == \"b\"){        \r\n      digitalWrite(in1, LOW); \r\n      digitalWrite(in2, HIGH); \r\n      analogWrite(enA, 200);\r\n      digitalWrite(in3, LOW);\r\n      digitalWrite(in4, HIGH);\r\n      analogWrite(enB, 200); \r\n    }\r\n        if(inputString == \"c\"){        \r\n      digitalWrite(in1, HIGH); \r\n      digitalWrite(in2, LOW); \r\n      analogWrite(enA, 150);\r\n      digitalWrite(in3, LOW);\r\n      digitalWrite(in4, LOW);\r\n      analogWrite(enB, 150); \r\n    }\r\n        if(inputString == \"d\"){        \r\n      digitalWrite(in1, LOW); \r\n      digitalWrite(in2, LOW); \r\n      analogWrite(enA, 150);\r\n      digitalWrite(in3, HIGH);\r\n      digitalWrite(in4, LOW);\r\n      analogWrite(enB, 150); \r\n    }\r\n    if(inputString == \"e\"){        \r\n      digitalWrite(in1, HIGH); \r\n      digitalWrite(in2, LOW); \r\n      analogWrite(enA, 150);\r\n      digitalWrite(in3, LOW);\r\n      digitalWrite(in4, HIGH);\r\n      analogWrite(enB, 150); \r\n    }\r\n    if(inputString == \"f\"){        \r\n      digitalWrite(in1, LOW); \r\n      digitalWrite(in2, HIGH); \r\n      analogWrite(enA, 150);\r\n      digitalWrite(in3, HIGH);\r\n      digitalWrite(in4, LOW);\r\n      analogWrite(enB, 150); \r\n    }\r\n\r\n      if(inputString == \"h\"){  \r\n      digitalWrite(in1, LOW); \r\n      digitalWrite(in2, LOW); \r\n      digitalWrite(in3, LOW);\r\n      digitalWrite(in4, LOW);\r\n    }\r\n      if(inputString == \"i\"){  \r\n      digitalWrite(11, HIGH);\r\n      }          \r\n      if(inputString == \"j\"){  \r\n      digitalWrite(11, LOW);\r\n      }\r\n      if(inputString == \"k\"){  \r\n      digitalWrite(3, HIGH);\r\n      }\r\n      if(inputString == \"l\"){  \r\n      digitalWrite(3, LOW);\r\n      }    \r\n   inputString = \"\";\r\n  }\r\n}\r\n``` \r\n\r\n\r\nAnd the one with servo(nonworking):\r\n```ino\r\n#define trigPin 13\r\n#define echoPin 12\r\n#include <Servo.h>\r\nServo myservo;\r\nchar junk;\r\nString inputString=\"\";\r\nint enA = 10;\r\nint in1 = 9;\r\nint in2 = 8;\r\n// motor two\r\nint enB = 5;\r\nint in3 = 7;\r\nint in4 = 6;\r\nint ledPin1 = 3;\r\nint laserPin2 = 11;\r\nvoid setup() {\r\n  myservo.attach(4);\r\n  pinMode(11, OUTPUT);\r\n  pinMode(3, OUTPUT);\r\n  pinMode(trigPin, OUTPUT);\r\n  pinMode(echoPin, INPUT);\r\n  Serial.begin(9600);\r\n  pinMode(enA, OUTPUT);\r\n  pinMode(enB, OUTPUT);\r\n  pinMode(in1, OUTPUT);\r\n  pinMode(in2, OUTPUT);\r\n  pinMode(in3, OUTPUT);\r\n  pinMode(in4, OUTPUT);\r\n  myservo.write(90);\r\n}\r\n\r\nvoid loop() \r\n{\r\n      long duration, distance;\r\n  digitalWrite(trigPin, LOW);  \r\n  delayMicroseconds(2); \r\n  digitalWrite(trigPin, HIGH);\r\n  delayMicroseconds(10); \r\n  digitalWrite(trigPin, LOW);\r\n  duration = pulseIn(echoPin, HIGH);\r\n  distance = (duration/2) / 29.1;\r\n  if(distance < 20)\r\n  {\r\n  digitalWrite(in1, LOW);\r\n  digitalWrite(in2, LOW);  \r\n  digitalWrite(in3, LOW);\r\n  digitalWrite(in4, LOW);\r\n  delay(2000);\r\n  digitalWrite(in1, LOW);\r\n  digitalWrite(in2, HIGH);  \r\n  digitalWrite(in3, LOW);\r\n  digitalWrite(in4, HIGH);\r\n  delay(500);\r\n  digitalWrite(in1, HIGH);\r\n  digitalWrite(in2, LOW);\r\n  analogWrite(enA, 200);\r\n  digitalWrite(in3, LOW);\r\n  digitalWrite(in4, LOW);\r\n  analogWrite(enB, 200);\r\n  delay(500);\r\n  digitalWrite(in1, HIGH);\r\n  digitalWrite(in2, LOW);\r\n  analogWrite(enA, 200);\r\n  digitalWrite(in3, HIGH);\r\n  digitalWrite(in4, LOW);\r\n  analogWrite(enB, 200);\r\n  }\r\nif(Serial.available()){\r\n    while(Serial.available())\r\n    {\r\n      char inChar = (char)Serial.read(); //read the input\r\n      inputString += inChar;        //make a string of the characters coming on serial\r\n    }\r\n    Serial.println(inputString);\r\n    while (Serial.available() > 0)  \r\n    { junk = Serial.read() ; } \r\n    if(inputString == \"a\"){        \r\n      digitalWrite(in1, HIGH); \r\n      digitalWrite(in2, LOW); \r\n      analogWrite(enA, 200);\r\n      digitalWrite(in3, HIGH);\r\n      digitalWrite(in4, LOW);\r\n      analogWrite(enB, 200); \r\n    }\r\n        if(inputString == \"b\"){        \r\n      digitalWrite(in1, LOW); \r\n      digitalWrite(in2, HIGH); \r\n      analogWrite(enA, 200);\r\n      digitalWrite(in3, LOW);\r\n      digitalWrite(in4, HIGH);\r\n      analogWrite(enB, 200); \r\n    }\r\n        if(inputString == \"c\"){        \r\n      digitalWrite(in1, HIGH); \r\n      digitalWrite(in2, LOW); \r\n      analogWrite(enA, 150);\r\n      digitalWrite(in3, LOW);\r\n      digitalWrite(in4, LOW);\r\n      analogWrite(enB, 150); \r\n    }\r\n        if(inputString == \"d\"){        \r\n      digitalWrite(in1, LOW); \r\n      digitalWrite(in2, LOW); \r\n      analogWrite(enA, 150);\r\n      digitalWrite(in3, HIGH);\r\n      digitalWrite(in4, LOW);\r\n      analogWrite(enB, 150); \r\n    }\r\n    if(inputString == \"e\"){        \r\n      digitalWrite(in1, HIGH); \r\n      digitalWrite(in2, LOW); \r\n      analogWrite(enA, 150);\r\n      digitalWrite(in3, LOW);\r\n      digitalWrite(in4, HIGH);\r\n      analogWrite(enB, 150); \r\n    }\r\n    if(inputString == \"f\"){        \r\n      digitalWrite(in1, LOW); \r\n      digitalWrite(in2, HIGH); \r\n      analogWrite(enA, 150);\r\n      digitalWrite(in3, HIGH);\r\n      digitalWrite(in4, LOW);\r\n      analogWrite(enB, 150); \r\n    }\r\n\r\n      if(inputString == \"h\"){  \r\n      digitalWrite(in1, LOW); \r\n      digitalWrite(in2, LOW); \r\n      digitalWrite(in3, LOW);\r\n      digitalWrite(in4, LOW);\r\n    }\r\n      if(inputString == \"i\"){  \r\n      digitalWrite(11, HIGH);\r\n      }          \r\n      if(inputString == \"j\"){  \r\n      digitalWrite(11, LOW);\r\n      }\r\n      if(inputString == \"k\"){  \r\n      digitalWrite(3, HIGH);\r\n      }\r\n      if(inputString == \"l\"){  \r\n      digitalWrite(3, LOW);\r\n      }    \r\n   inputString = \"\";\r\n  }\r\n}\r\n```\r\n\r\nEverything is working normally without servo, but I need one for the future projects and for the school competition so please respond quickly. If you can help me email me on: cirilkoemil@gmail.com\r\nAnd if needed I can show you via skype(witch I will give after emailing me)."},"comment":{"url":"https://api.github.com/repos/rwaldron/johnny-five/issues/comments/160187982","html_url":"https://github.com/rwaldron/johnny-five/issues/970#issuecomment-160187982","issue_url":"https://api.github.com/repos/rwaldron/johnny-five/issues/970","id":160187982,"user":{"login":"EmilLipovsek","id":16049324,"avatar_url":"https://avatars.githubusercontent.com/u/16049324?v=3","gravatar_id":"","url":"https://api.github.com/users/EmilLipovsek","html_url":"https://github.com/EmilLipovsek","followers_url":"https://api.github.com/users/EmilLipovsek/followers","following_url":"https://api.github.com/users/EmilLipovsek/following{/other_user}","gists_url":"https://api.github.com/users/EmilLipovsek/gists{/gist_id}","starred_url":"https://api.github.com/users/EmilLipovsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmilLipovsek/subscriptions","organizations_url":"https://api.github.com/users/EmilLipovsek/orgs","repos_url":"https://api.github.com/users/EmilLipovsek/repos","events_url":"https://api.github.com/users/EmilLipovsek/events{/privacy}","received_events_url":"https://api.github.com/users/EmilLipovsek/received_events","type":"User","site_admin":false},"created_at":"2015-11-27T18:44:32Z","updated_at":"2015-11-27T18:44:32Z","body":"It is ok I understood. Thank you very much my tank is now working properly.\r\nI found this website today. And I just wanted to know how to fix this problem, but I will probably continue using this forum. So I wanted to know what is Johnny-Five?"}}