Skip to content

Instantly share code, notes, and snippets.

@spacecowb0y
Last active August 14, 2019 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spacecowb0y/bb614b5f2dd2ba3b9a639fe838059dac to your computer and use it in GitHub Desktop.
Save spacecowb0y/bb614b5f2dd2ba3b9a639fe838059dac to your computer and use it in GitHub Desktop.

Instructions

  1. Download Arduino Software
  2. Menu > Tools > Follow the settings instructions
  3. Upload the script
  4. Profit! 💰

Settings

Board: "Arduino Nano"

Processor: "ATmega328P (Old Bootloader)"

Port: Select the USB port witch the arduino board is connected

// Include the Arduino Stepper Library
#include <Stepper.h>
// Number of steps per output rotation
const int stepsPerRevolution = 400;
// Create Instance of Stepper library
Stepper myStepper(stepsPerRevolution, 2, 3);
void setup()
{
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop()
{
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(1000);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(10000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment