Last active
May 19, 2022 12:15
-
-
Save DIEGOHORVATTI/9dd760ed719f74487c613c452942b4f0 to your computer and use it in GitHub Desktop.
Rodar motores com arduno
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
#include <Arduino.h> | |
const int pulPin = 2; | |
const int dirPin = 3; | |
const int enPin = 4; | |
int x; | |
int delayrotacao = 500; | |
void setup() { | |
pinMode(pulPin,OUTPUT); | |
pinMode(dirPin,OUTPUT); | |
pinMode(enPin,OUTPUT); | |
digitalWrite(enPin,LOW); | |
} | |
void loop() { | |
digitalWrite(dirPin,HIGH); | |
if(x - 1000){ | |
digitalWrite(pulPin,HIGH); | |
delayMicroseconds(delayrotacao); | |
digitalWrite(pulPin,LOW); | |
delayMicroseconds(delayrotacao); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment