Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: LinearRailSlide - Source Code compiled for: Arduino Uno - Source Code created on: 2023-11-29 21:29:17 - Source Code generated by: Francesco Alessandro ********* Pleasedontcode.com **********/ /****** DEFINITION OF LIBRARIES *****/ #include
#include
/****** SYSTEM REQUIREMENT 1 *****/ /* A stepper motor drives a 100mm length linear rail */ /* slide. The motor performs 200 steps per */ /* revolution. Each revolution moves the slide 10mm. */ /****** SYSTEM REQUIREMENT 2 *****/ /* Perform a complete travel from right to left in 12 */ /* hours. Then perform a complete travel from left to */ /* right of other 12 hours. */ /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF DIGITAL OUTPUT PINS *****/ const uint8_t stepper_A4988StepperMotorDriver_STEP_PIN_D8 = 8; const uint8_t stepper_A4988StepperMotorDriver_DIR_PIN_D9 = 9; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ AccelStepper stepper(1, stepper_A4988StepperMotorDriver_STEP_PIN_D8, stepper_A4988StepperMotorDriver_DIR_PIN_D9); void setup(void) { // put your setup code here, to run once: pinMode(stepper_A4988StepperMotorDriver_STEP_PIN_D8, OUTPUT); pinMode(stepper_A4988StepperMotorDriver_DIR_PIN_D9, OUTPUT); stepper.setMaxSpeed(200.0); stepper.setAcceleration(100.0); stepper.moveTo(2000); // Move the stepper motor 2000 steps } void loop(void) { // put your main code here, to run repeatedly: stepper.run(); if (stepper.distanceToGo() == 0) { // Reverse the direction when the stepper motor reaches the target position stepper.moveTo(-stepper.currentPosition()); } delay(1); }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)