이하늘
Published © GPL3+

Motor

Move the motor by analog sensor.

BeginnerWork in progress30 minutes510
Motor

Schematics

20170622_202351_ziSlgyg8r3.jpg

Code

motor

Arduino
#include <Servo.h>
Servo servo0;

int analogIn0 = A0;
int analogValue0;
int servo0pos = 0;
int myDelay = 15;
void setup() {
  servo0.attach(3);
}

void loop() {
 analogValue0 = analogRead(analogIn0);
 analogValue0 = map(analogValue0, 0, 1023, 0, 179);
 servo0.write(analogValue0);
 delay(myDelay);
}

Credits

이하늘

이하늘

5 projects • 3 followers

Comments