Last active
June 19, 2020 09:08
-
-
Save sebadima/a86c9147a14926b8f81687f226736055 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Driver per motore elettrico brushed | |
Robotdazero - https://www.robotdazero.it | |
Il circuito: | |
- pin 9 di Arduino collegato alla base del TIP120 | |
creato 16 Maggio 2018 | |
modificato 18 Febbraio 2020 | |
by sebadima | |
- This example code is in the public domain. | |
- Questo programma viene fornito gratuitamente | |
anche per usi commerciali. | |
*/ | |
int pinMotorino = 9; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(pinMotorino, OUTPUT); | |
} | |
void loop() { | |
Serial.print("LOOP\n"); | |
// accelerazione progressiva del motore | |
for(int x = 0; x <= 255; x++){ | |
analogWrite(pinMotorino, x); | |
delay(10); | |
} | |
// rallentamento progressivo | |
for(int x = 255; x >= 20; x--){ | |
analogWrite(pinMotorino, x); | |
delay(10); | |
} | |
// pausa brevissima introdotto solo per precauzione | |
delay(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment