Open Sessame

I created a mini wall that turns 90 degrees only when both of the switches are pressed. This is a prototype for a piece that I am thinking of expending on for my Capstone project.

Here is the schematic:


The code itself is very simple. When both switches are pressed, it turns 90 degrees, revealing the other side of the wall, and when it is not, it returns back to the original position, blocking the view of the other side.

#include <Servo.h> 
Servo myservo;
int pos = 90;
int val;
int switch1 = 2;
int switch2 = 4;
void setup() 
  pinMode(switch1, INPUT);
  pinMode(switch2, INPUT);
void loop() 
    if(digitalRead(switch1) == LOW && digitalRead(switch2) == LOW){
    if(digitalRead(switch1) == HIGH && digitalRead(switch2) == HIGH){

Leave a Reply