Midterm project. Maxim Blinov

Good day everyone!

So my project went as planned, except for some small changes. It is a tilt maze which actually work pretty well! Less detail, here is the video:

Here is my code which operates 2 servos and 2 pressure sensors.

#include <Servo.h>
 
Servo myServo;
Servo myServo1;


void setup() {
  myServo.attach(9);
  Serial.begin(9600);
  myServo1.attach(10);
  
}

void loop() {

  int pressure1 = analogRead(A0);
  int pressure2 = analogRead(A3);
  Serial.print(pressure1);
  Serial.print(" ");
  Serial.println(pressure2);
  int angle1 = map(pressure1, 0,970,90,30);
  int angle2 = map(pressure2, 0,970,110,30);
  myServo.write(angle1);
  myServo1.write(angle2);

}

 

Leave a Reply