Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_CircuitPlayground.h>
- #include <Mouse.h>
- #include <Wire.h>
- #include <SPI.h>
- #define XACCEL_MIN 0.2 // Min range of X axis acceleration, wont move below
- #define YACCEL_MIN 0.2 // Min range of Y axis acceleration, wont move below
- #define XThreshold 3.0 //the sensor is noisy, ignore slight variations
- #define YThreshold 3.0
- #define ZThreshold 3.0
- #define XSCREENSIZE 1280
- #define YSCREENSIZE 780
- float x=0.0;
- float y=0.0;
- float z=0.0;
- void setup() {
- CircuitPlayground.begin();
- Mouse.begin();
- Serial.begin(9600);
- }
- void loop() {
- // Check if the slide switch is enabled (on +) and if not then just exit out
- if (!CircuitPlayground.slideSwitch()) {
- return;
- }
- boolean left_first = CircuitPlayground.leftButton();
- //ok, we need resting position to be center of screen.
- float x1 = CircuitPlayground.motionX();
- float y1 = CircuitPlayground.motionY();
- float z1 = CircuitPlayground.motionZ();
- //if(z1)
- //now got think about this oh no...
- Serial.print("X: ");
- Serial.print(x);
- Serial.print(" Y: ");
- Serial.print(y);
- Serial.print(" Z: ");
- Serial.print(z);
- Serial.println();
- //move mouse to center
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement