Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
mPelectronic
Published © LGPL

Rotating Platform!

A small, portable rotating platform. Great for reviews!

IntermediateShowcase (no instructions)11,242
Rotating Platform!

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
ATtiny13
×1
Stepper motor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

The 3d model, altough it is just a prototype.

Code

The code

C/C++
int in1 = 0;
int in2 = 1;
int in3 = 2;
int in4 = 3;

int val = 1;

#define pot A0

void setup() {
  pinMode(in1,OUTPUT);
  pinMode(in2,OUTPUT);
  pinMode(in3,OUTPUT);
  pinMode(in4,OUTPUT);
  
  pinMode(pot, INPUT);
}

void loop() {
  val = analogRead(pot) / 200;

  digitalWrite(in1, HIGH);
  digitalWrite(in2, HIGH);
  delay(val);

  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  delay(val);

  digitalWrite(in2, HIGH);
  digitalWrite(in3, HIGH);
  delay(val);
  
  digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH);
  delay(val);
  
  digitalWrite(in3, HIGH);
  digitalWrite(in4, HIGH);
  delay(val);
  
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  delay(val);

  digitalWrite(in1, HIGH);
  digitalWrite(in4, HIGH);
  delay(val);
  
  digitalWrite(in1, HIGH);
  digitalWrite(in4, LOW);
  delay(val);

}

Credits

mPelectronic
3 projects • 23 followers
Contact

Comments

Please log in or sign up to comment.