SHARE
TWEET

Untitled

aaron83 Oct 27th, 2017 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <AnalogSmooth.h>
  2.  
  3. int analogPin = A0;
  4.  
  5. // Defaults to window size 10
  6. AnalogSmooth as = AnalogSmooth();
  7.  
  8. // Window size can range from 1 - 100
  9. AnalogSmooth as100 = AnalogSmooth(100);
  10.  
  11. void setup() {
  12.   Serial.begin(9600);
  13. }
  14.  
  15. // the loop routine runs over and over again forever:
  16. void loop() {
  17.   float analog = analogRead(analogPin);
  18.   // read the input on analog pin 0:
  19.   int sensorValue = analogRead(A0);
  20.   // print out the value you read:
  21.   Serial.println(sensorValue);
  22.   //delay(1);        // delay in between reads for stability
  23.   if (sensorValue < 481)
  24.   {Joystick.X(1);
  25.   }
  26.   else
  27.   Joystick.X(0);
  28.   if (sensorValue > 539)
  29.   {Joystick.X(-1);
  30.   }
  31.   else
  32.   Joystick.X(0);
  33.  
  34.   delay(100);
  35.   {
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top