avatar

Mamun Karim

Member Since: December 27, 2016

Country: Bangladesh

Profile

Senior Video Editor

  • // it works only 1 servo ...why not 2 servo work properly...i just modify the code average valu for servo jliter

    void Servo_Control1(){ int Pos1; inputPina = pulseIn(42, HIGH, 25000); // /Servo 2 Pos1 = map(inputPina, 1000, 2000, 0, 180); //center over zero Pos1 = constrain(Pos1, 0, 170);

    totala = totala - readingsa[readIndexa]; readingsa[readIndexa] = Pos1; totala = totala + readingsa[readIndexa]; readIndexa = readIndexa + 1; if (readIndexa >= numReadingsa) { // ...wrap around to the beginning: readIndexa = 0; }

    averagea = totala/ numReadingsa; Serial.println(averagea); myservo1.write(averagea); delay(1); }

    void Servo_Control2(){ int Pos2;

    inputPinb = pulseIn(44, HIGH, 25000); // /Servo 2 Pos2 = map(inputPinb, 1000, 2000, 0, 180); //center over zero Pos2 = constrain(Pos2, 0, 170);

    totalb = totalb - readingsb[readIndexb]; readingsb[readIndexb] = Pos2; totalb = totalb + readingsb[readIndexb]; readIndexb = readIndexb + 1; if (readIndexb >= numReadingsb) { // ...wrap around to the beginning: readIndexb = 0; }

    averageb = totalb / numReadingsb; Serial.println(averageb); myservo2.write(averageb); delay(1); }

  • im following ur code ... but im using flysky th9x reciver my problem is when i add pen til servo on it ... it only work 1 servo ... why dont i use 2 servo same time

No public wish lists :(