Devices & Components
Arduino Uno Rev3
SG90 Micro-servo motor
Jumper wires (generic)
Hardware & Tools
Hot glue gun (generic)
Software & Tools
Arduino IDE
Project description
Code
Code for K.M automatic fish feeder
c_cpp
EZ
1#include <Servo.h> 2 3Servo myservo; // create servo object to control a servo 4// twelve servo objects can be created on most boards 5 6int pos = 0; // variable to store the servo position 7 8 9void setup() { 10 myservo.attach(9); // attaches the servo on pin 9 to the servo object 11} 12 13void loop() { 14 15 for (pos = 0; pos <= 20; pos += 1) { // goes from 0 degrees to 180 degrees 16 // in steps of 1 degree 17 myservo.write(pos); // tell servo to go to position in variable 'pos' 18 delay(5); // waits 15ms for the servo to reach the position 19 } 20 for (pos = 20; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees 21 22 myservo.write(pos); // tell servo to go to position in variable 'pos' 23 delay(5); // waits 15ms for the servo to reach the position 24 } 25delay(480* 60 * 1000UL);
Downloadable files
how to circuit
It's simple. EZ
how to circuit

how to circuit
It's simple. EZ
how to circuit

Comments
Only logged in users can leave comments