0% found this document useful (0 votes)
34 views1 page

Code

The document contains code to control the movement of a servo motor by rotating it to 0, 90, and 180 degrees using delays of 1000 milliseconds between each rotation. The code defines a servo pin, sets the pin as output, and contains functions to setup the pin and loop through rotating the servo to different angles using delays.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

Code

The document contains code to control the movement of a servo motor by rotating it to 0, 90, and 180 degrees using delays of 1000 milliseconds between each rotation. The code defines a servo pin, sets the pin as output, and contains functions to setup the pin and loop through rotating the servo to different angles using delays.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

int servoPin1=3;

float pausa;
void setup () {
pinMode (servo,OUTPUT);
}

void loop () {
giro(0);
delay (1000);
giro (90);
delay (1000);
giro (180);
delay (1000);
}

void giro(int X) {
for(int hz=1;hz<50;hz**) {
pausa = (X * 2000.0/200.)+500;
digitalWrite(servoPin1, HIGH);
delayMicroseconds(pausa);
digitalWrite(servoPin1,LOW);
delayMicroseconds(23000-pausa);
}

int servoPin=;
float pausa;
void setup () {
pinMode (servo,OUTPUT);

You might also like