Dog PET feeder with step motor 28BYJ-48
thingiverse
This is a C++ code snippet for an Arduino project that controls a stepper motor and an LED based on time schedules. Here's a breakdown of the code: **Fine Adjust** The first section of the code deals with fine adjustments to the stepper motor position using two buttons: `ajustefino_cw` (clockwise) and `ajustefino_ccw` (counter-clockwise). When one of these buttons is pressed, the corresponding function (`pasoclockwise()` or `pasoanticlockwise()`) is called. These functions increment or decrement the stepper motor position by a small amount (100 steps). **Timer** The next section of the code deals with time schedules. It uses the `RTC` (Real-Time Clock) module to get the current date and time, and then checks if it's scheduled to turn on or off the LED. If it is scheduled to turn on, it sets the `state` variable to `true`, turns on the LED, and runs a small sequence of stepper motor movements (50 steps in each direction). If it's not scheduled to turn on, it sets the `state` variable to `false` and turns off the LED. **Functions** There are several functions defined in this code: * `printDate(DateTime date)`: prints the current date and time to the serial console. * `isScheduledON(DateTime date)`: checks if it's scheduled to turn on the LED based on the time of day and day of the week. * `clockwise()`, `anticlockwise()`: increment or decrement the stepper motor position by one step, respectively. * `setOutput(int step)`: sets the output pins of the stepper motor based on the current step number. **Variables** There are several variables defined in this code: * `state`: a boolean variable that indicates whether the LED should be turned on or off. * `stepCounter`: an integer variable that keeps track of the current stepper motor position. * `numSteps`: an integer variable that defines the total number of steps in the stepper motor's sequence. * `motorPin1`, `motorPin2`, `motorPin3`, `motorPin4`: output pins used to control the stepper motor. * `stepsLookup`: a lookup table used to map step numbers to output pin values. Overall, this code is designed to turn on and off an LED based on time schedules, while also allowing for fine adjustments to the stepper motor position using two buttons.
With this file you will be able to print Dog PET feeder with step motor 28BYJ-48 with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Dog PET feeder with step motor 28BYJ-48.