I have cats and they like lasers so I'v bin working on a 2 servo mechanism that moves the laser up down and side to side, this is controlled by and arduino nano but I don't know why the code isn't working. pics and code below
#include <Servo.h>
Servo xAxis; //left and right movement of laser
Servo yAxis; //up and down controll of laser
int posX = 0; //stores posision of x axis servo
int posY = 0; //stores posision of y axis servo
void setup(){
xAxis.attach(19); //attaches the x axis servo to pin 19
yAxis.attach(20); //attaches the y axis servo to pin 20
}
void loop(){
xAxis.write(posX); //sets servo to posX var
yAxis.write(posY); //sets servo to posY var
}
posted pics on twitter, they were to large to put right on the post