Random Stuff We Make!
Published © GPL3+

COVID-19 Lazy Work from home HACK

A device to let you hack your work from home for a better sound sleep in the quarantine period of COVID-19.

BeginnerFull instructions provided1 hour1,200

Things used in this project

Story

Read more

Schematics

Schematics

Connect the servo motor to the arduino uno as shown in image

Code

Code

Arduino
Arduino IDE code
// The following code is created by makers of Random Stuff We Make
//For more such content, please follow us on instagram

#include <Servo.h>
Servo myservo;  // create servo object to control a servo

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() 
{
  for (pos = 80; pos <= 130; pos += 1)  // goes from 80 degrees to 130 degrees in steps of 1 degree
     
  {
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(5);                       // waits 5ms for the servo to reach the position
  }
  
  for (pos = 130; pos >= 80; pos -= 1) // goes from 130 degrees to 80 degrees
  { 
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(5);                       // waits 5ms for the servo to reach the position
  }
}

Credits

Random Stuff We Make!
18 projects • 66 followers
We at RSWM! try to bring Fiction to Reality through projects which are Interactive, Creative & way too simpler in terms of making.

Comments