Hi,
I want to interface multiple servo sg90 with arduino nano,
I tried the following code
I tried the two following circuits
But no motor worked,but when i tried the example code for one servo motor it worked.
Could anyone help me
I want to interface multiple servo sg90 with arduino nano,
I tried the following code
Code:
#include <Servo.h>
Servo myservof1; Servo myservof2;
Servo myservof3; Servo myservof4; Servo myservof5;
int potpin = A0;
int val;
void setup() {
myservof1.attach(9); myservof2.attach(3);
myservof3.attach(5);
myservof4.attach(6);
myservof5.attach(10);
}
void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it for use with the servo (value between 0 and 180)
myservof1.write(val);
myservof2.write(val);
myservof3.write(val);
myservof4.write(val);
myservof5.write(val);
delay(15);
}
But no motor worked,but when i tried the example code for one servo motor it worked.
Could anyone help me