Skip to content

Instantly share code, notes, and snippets.

View giljr's full-sized avatar
💭
Full Stack Developer with a degree in Computer Engineering.

Gilberto Oliveira Jr giljr

💭
Full Stack Developer with a degree in Computer Engineering.
View GitHub Profile
/*
BTS 7960B
*/
int RPWM1 = 5; // Two board used here, 1
int LPWM1 = 6;
int L_EN1 = 7;
int R_EN1 = 8;
int RPWM2 = 9; // and 2
const int AIA = 3;
const int AIB = 4;
const int BIA = 5; // If you have the dual driver remove
const int BIB = 6; // the comments and enable the other engine
byte speed = 255;
void setup() {
Serial.begin(9600);
pinMode(AIA, OUTPUT);
pinMode(AIB, OUTPUT);
// HALF STEP
#define stepper PORTB
#define waiting_time 500
void setup() {
for (int z = 8; z < 12; z++) {
pinMode(z, OUTPUT); // pins 8,9,10,11 output for driving the motor
// Full Step
#define stepper PORTB
#define waiting_time 500
void setup() {
for (int z = 8; z < 12; z++) { // FULL STEP DRIVE
pinMode(z, OUTPUT); // pins 8,9,10,11 output for driving the motor
}
// WAVE DRIVE
#define stepper PORTB
#define waiting_time 500
void setup() {
for (int z = 8; z < 12; z++) {
pinMode(z, OUTPUT); // pins 8,9,10,11 output for driving the motor
#define control1 8 // pin that controls the MOSFET
#define control2 9 // pin that controls the MOSFET
void setup() {
pinMode(control1, OUTPUT); // define control pin as output
pinMode(control2, OUTPUT); // define control pin as output
Serial.begin(9600);
#define control 8 // pin that controls the MOSFET
void setup() {
// IRF520 MOSFET
pinMode(control, OUTPUT); // define control pin as output
Serial.begin(9600);
}
/* Adafruit v1 */
#include <AFMotor.h> //Include library AF Motor
AF_DCMotor motor3(3); // Motor 1 Selected
AF_DCMotor motor4(4); // Motor 1 Selected
unsigned char velocidade1 = 0x00; // Storage motor1 Speed (8 bits)
/* Adafruit v2 */
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *frontMotor = AFMS.getMotor(3);
Adafruit_DCMotor *backMotor = AFMS.getMotor(4);
#include <AFMotor.h> //Include library AF Motor
AF_DCMotor motor1(1); // Motor 1 Selected
unsigned char velocidade1 = 0x00; // Storage motor1 Speed (8 bits)