Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //A0 is Right Rotation.
- //A1 is Left Rotation.
- //A2 is Right Pressure.
- //A3 is Left Pressure.
- int cur = 0;
- int dur = 0;
- void setup() {
- cur = analogRead(A0);
- dur = analogRead(A1);
- Mouse.begin();
- }
- void loop() {
- if(!((analogRead(A2)>500)&&(analogRead(A3)>500))){
- if(analogRead(A2)>500) {
- if (abs(cur-analogRead(A0))>1){
- Mouse.move((cur-analogRead(A0))*-1,0);
- cur = analogRead(A0);
- }
- }else if(analogRead(A3)>500){
- if (abs(dur-analogRead(A1))>1){
- Mouse.move((dur-analogRead(A1))*-1,0);
- dur = analogRead(A1);
- }
- }
- }
- delay(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement