Advertisement
Guest User

Simulacrum Beta 1

a guest
Jul 21st, 2012
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. //A0 is Right Rotation.
  2. //A1 is Left Rotation.
  3. //A2 is Right Pressure.
  4. //A3 is Left Pressure.
  5.  
  6. int cur = 0;
  7. int dur = 0;
  8. void setup() {
  9.   cur = analogRead(A0);
  10.   dur = analogRead(A1);
  11.   Mouse.begin();
  12. }
  13.  
  14. void loop() {
  15.   if(!((analogRead(A2)>500)&&(analogRead(A3)>500))){
  16.   if(analogRead(A2)>500) {
  17.     if (abs(cur-analogRead(A0))>1){
  18.       Mouse.move((cur-analogRead(A0))*-1,0);
  19.       cur = analogRead(A0);
  20.     }
  21.   }else if(analogRead(A3)>500){
  22.     if (abs(dur-analogRead(A1))>1){
  23.       Mouse.move((dur-analogRead(A1))*-1,0);
  24.       dur = analogRead(A1);
  25.     }
  26.   }
  27.   }
  28.   delay(1);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement