Recently purchased a Inventors Kit for a school project and was hoping to get a servo to respond to a mouse moving up and down the x axis without going beyond the 180 range of the toy servo. I was able to run the servo from the beginners guide and also was able to get it to work based off of a mouses on screen movements. Unfortunately the screen is not going to be visible during use so I need it to not be limited to a area I cant blindly stay in. Any suggestions for other tutorials or project s floating around would be fantastic.
This is the code I was using from the online tutorial. From your post's I've gather I should be assigning a set of high and low's somewhere. I can see were the grey note is explaining that section of the code but I don't see how it is controlling it
//Output the servo position ( from 0 to 180)
port.write("s"+spos);
gx = x;
gy = x;
}
I was able to cut out things I learned I didn't need and switch it to the Y axis as I was hoping to do. I resized it to my screens resolution and changed the division so I am getting 180 degree. I just cant figure out how to add an exception to stop it when it gets to the top of the screen. The servo properly stops at the bottom but I need it to cut out when it reaches the top of the block also, other wise it will burn it out.