Advertisement
witampanstwa

Untitled

Dec 9th, 2020
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. class JoystickIn {
  2. private:
  3.     int x_;
  4.     int y_;
  5.  
  6. public:
  7.     int getX() const {
  8.         return x_;
  9.     }
  10.  
  11.     void setX(int x) {
  12.         if (x != x_) {
  13.             x_ = x;
  14.  
  15.             Serial.println("Nowy x: ".concat(x_));
  16.         }
  17.     }
  18.  
  19.     int getY() const {
  20.         return y_;
  21.     }
  22.  
  23.     void setY(int y) {
  24.         if (y != y_) {
  25.             y_ = y;
  26.  
  27.             Serial.println("Nowy y: ".concat(y_));
  28.         }
  29.     }
  30. };
  31.  
  32. void setup() {
  33.     Serial.begin(115200);
  34. }
  35.  
  36. void loop() {
  37.     JoystickIn *joystickIn = new JoystickIn();
  38.  
  39.     joystickIn->setX(2137);
  40.     joystickIn->setY(69);
  41.  
  42.     delete joystickIn;
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement