Search models, users, collections, and posts

Toy elevator

GIF

Print Profile(1)

All
P1S
P1P
X1
X1 Carbon
X1E
A1
H2D
H2D Pro
H2S
P2S
H2C
X2D
A2L

0.2mm layer, 2 walls, 15% infill
0.2mm layer, 2 walls, 15% infill
Designer
4.2 h
2 plates
5.0(2)

Open in Bambu Studio
Boost
39
83
3
2
94
43
Released 

Description

给小朋友做的一个电梯玩具。需要用到

28byj-48 step motor

Arduino board

string

connection wires

2 buttons

 

code

#include <Stepper.h>


 

const int buttonPin2 = 2;

const int buttonPin1 = 3;

int buttonState1 = 0;

int buttonState2 = 0;


 

// Define the number of steps per revolution (for 28BYJ-48, typically 512 steps for one full revolution)

const int stepsPerRevolution = 512;  // 512 steps per revolution for the 28BYJ-48 stepper motor


 

// Initialize the Stepper library with the pins connected to the ULN2003 driver

Stepper stepper(stepsPerRevolution, 8, 10, 9, 11);  // IN1, IN2, IN3, IN4


 

void setup() {

  // Set the motor speed (in RPM)

  stepper.setSpeed(65);  // Adjust the speed, 15 RPM is a good starting point

  pinMode(buttonPin1, INPUT_PULLUP);

  pinMode(buttonPin2, INPUT_PULLUP);

  Serial.begin(9600);

}


 

void loop() {

  buttonState1 = digitalRead(buttonPin1);

  buttonState2 = digitalRead(buttonPin2);

  Serial.print(buttonState1);

  Serial.print(buttonState2);

  if (buttonState1 == LOW) {

    // Rotate clockwise

    Serial.println("Rotating Clockwise");

    stepper.step(stepsPerRevolution);  // Rotate 1 full revolution clockwise

  }else if (buttonState2 == LOW) {

    // Rotate counter-clockwise

    Serial.println("Rotating Counter-Clockwise");

    stepper.step(-stepsPerRevolution);  // Rotate 1 full revolution counter-clockwise

  } else {

    stepper.step(0);

  }

}


Documentation (1)

Assembly Guide (1)
20250216_164634.jpg

Comment & Rating (3)

(0/1000)