Skip to content

Instantly share code, notes, and snippets.

@DIEGOHORVATTI
Last active May 19, 2022 12:15
Show Gist options
  • Save DIEGOHORVATTI/9dd760ed719f74487c613c452942b4f0 to your computer and use it in GitHub Desktop.
Save DIEGOHORVATTI/9dd760ed719f74487c613c452942b4f0 to your computer and use it in GitHub Desktop.
Rodar motores com arduno
#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