Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <AnalogSmooth.h>
- int analogPin = A0;
- // Defaults to window size 10
- AnalogSmooth as = AnalogSmooth();
- // Window size can range from 1 - 100
- AnalogSmooth as100 = AnalogSmooth(100);
- void setup() {
- Serial.begin(9600);
- }
- // the loop routine runs over and over again forever:
- void loop() {
- float analog = analogRead(analogPin);
- // read the input on analog pin 0:
- int sensorValue = analogRead(A0);
- // print out the value you read:
- Serial.println(sensorValue);
- //delay(1); // delay in between reads for stability
- if (sensorValue < 481)
- {Joystick.X(1);
- }
- else
- Joystick.X(0);
- if (sensorValue > 539)
- {Joystick.X(-1);
- }
- else
- Joystick.X(0);
- delay(100);
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement