apuntes_Arduino/motores/dc/bateria9v/bateria9v.ino

45 lines
844 B
Arduino
Raw Normal View History

2021-01-05 00:15:16 -03:00
int MOTOR=3;
int i;
byte velocidad = 1;
int pausa = 12000;
void setup(){
pinMode(MOTOR, OUTPUT);
//Serial.begin(115200);
analogWrite(MOTOR, 0);
}
void loop(){
/*
for(i=150; i<=255; i++){
analogWrite(MOTOR, i);
//Serial.print(" "+String(i));
delay(velocidad);
}
//Serial.println("");
delay(pausa);
for(i=255; i>=150; i--){
analogWrite(MOTOR, i);
//Serial.print(" "+String(i));
delay(velocidad);
}
//Serial.println("");
*/
analogWrite(MOTOR, 215);
delay(pausa);
analogWrite(MOTOR, 0);
delay(5000);
analogWrite(MOTOR, 235);
delay(pausa);
analogWrite(MOTOR, 0);
delay(5000);
analogWrite(MOTOR, 255);
delay(pausa);
/*
analogWrite(MOTOR, 255);
delay(pausa);
analogWrite(MOTOR, 0);
delay(velocidad);
*/
}