Відповісти

Введіть повідомлення і натисніть Надіслати
Параметри

Назад

Огляд теми (нові повідомленні вгорі)

г0сть
2022-05-25 20:16:56

виноват, исправлюсь   tongue

vvr
2022-05-25 20:14:10

Ты не умничай, а срочно помогай)))
Документацию читать не барское дело ..

г0сть
2022-05-25 17:25:14

Первая же ссылка в гугле по запросу Mouse.h -
https://www.arduino.cc/reference/en/language/functions/usb/mouse/
These core libraries allow the 32u4 and SAMD based boards (Leonardo, Esplora, Zero, Due and MKR Family)
А на uno - mega328

Malyhin
2022-05-25 16:58:57

помогите, срочно надо

Malyhin
2022-05-25 13:21:42

Uno

г0сть
2022-05-25 13:13:09

Ты для какой ардуины ее подключаешь?

Malyhin
2022-05-25 12:57:51

решил загрузить один пример из ардуино с библиотекой Маус и при компилации дает ошибку:

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Плата: "Arduino Uno"

In file included from D:UserDatamikeOneDriveDesktopпапкиarduinoJoystickMouseControlJoystickMouseControl.ino:33:0:

D:UserDatamikeOneDrive\ArduinolibrariesMousesrc/Mouse.h:29:2: warning: #warning "Using legacy HID core (non pluggable)" [-Wcpp]

 #warning "Using legacy HID core (non pluggable)"

  ^~~~~~~

D:UserDatamikeOneDriveDesktopпапкиarduinoJoystickMouseControlJoystickMouseControl.ino: In function 'void setup()':

JoystickMouseControl:55:3: error: 'Mouse' не знайдено. Чи містить ваш скетч рядок '#include <Mouse.h>'?

D:UserDatamikeOneDriveDesktopпапкиarduinoJoystickMouseControlJoystickMouseControl.ino: In function 'void loop()':

JoystickMouseControl:78:5: error: 'Mouse' не знайдено. Чи містить ваш скетч рядок '#include <Mouse.h>'?

JoystickMouseControl:85:10: error: 'Mouse' не знайдено. Чи містить ваш скетч рядок '#include <Mouse.h>'?

JoystickMouseControl:85:26: error: 'MOUSE_LEFT' was not declared in this scope

D:UserDatamikeOneDriveDesktopпапкиarduinoJoystickMouseControlJoystickMouseControl.ino:85:26: note: suggested alternative: 'MOUSE_h'

JoystickMouseControl:92:9: error: 'Mouse' не знайдено. Чи містить ваш скетч рядок '#include <Mouse.h>'?

JoystickMouseControl:92:25: error: 'MOUSE_LEFT' was not declared in this scope

D:UserDatamikeOneDriveDesktopпапкиarduinoJoystickMouseControlJoystickMouseControl.ino:92:25: note: suggested alternative: 'MOUSE_h'

Декілька бібліотек було знайдено для «Mouse.h»

 Використано: D:UserDatamikeOneDriveДокументыArduinolibrariesMouse

 Не використовується: C:Program FilesWindowsAppsArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wttlibrariesMouse

exit status 1

'Mouse' не знайдено. Чи містить ваш скетч рядок '#include <Mouse.h>'?



Цей звіт міститиме більше інформації, якщо
в меню Файл -> Налаштування увімкнути опцію
"Показати докладний звіт при компіляції".

и вот код:

/*
  JoystickMouseControl

  Controls the mouse from a joystick on an Arduino Leonardo, Micro or Due.
  Uses a pushbutton to turn on and off mouse control, and a second pushbutton
  to click the left mouse button.

  Hardware:
  - 2-axis joystick connected to pins A0 and A1
  - pushbuttons connected to pin D2 and D3

  The mouse movement is always relative. This sketch reads two analog inputs
  that range from 0 to 1023 (or less on either end) and translates them into
  ranges of -6 to 6.
  The sketch assumes that the joystick resting values are around the middle of
  the range, but that they vary within a threshold.

  WARNING: When you use the Mouse.move() command, the Arduino takes over your
  mouse! Make sure you have control before you use the command. This sketch
  includes a pushbutton to toggle the mouse control state, so you can turn on
  and off mouse control.

  created 15 Sep 2011
  updated 28 Mar 2012
  by Tom Igoe

  This example code is in the public domain.

  https://www.arduino.cc/en/Tutorial/BuiltInExamples/JoystickMouseControl
*/

#include <Mouse.h>

// set pin numbers for switch, joystick axes, and LED:
const int switchPin = 2;      // switch to turn on and off mouse control
const int mouseButton = 9;    // input pin for the mouse pushButton
const int xAxis = A0;         // joystick X axis
const int yAxis = A1;         // joystick Y axis
const int ledPin = 13;         // Mouse control LED

// parameters for reading the joystick:
int range = 12;               // output range of X or Y movement
int responseDelay = 5;        // response delay of the mouse, in ms
int threshold = range / 4;    // resting threshold
int center = range / 2;       // resting position value

bool mouseIsActive = false;    // whether or not to control the mouse
int lastSwitchState = LOW;        // previous switch state

void setup() {
  pinMode(switchPin, INPUT);       // the switch pin
  pinMode(ledPin, OUTPUT);         // the LED pin
  // take control of the mouse:
  Mouse.begin();
}

void loop() {
  // read the switch:
  int switchState = digitalRead(switchPin);
  // if it's changed and it's high, toggle the mouse state:
  if (switchState != lastSwitchState) {
    if (switchState == HIGH) {
      mouseIsActive = !mouseIsActive;
      // turn on LED to indicate mouse state:
      digitalWrite(ledPin, mouseIsActive);
    }
  }
  // save switch state for next comparison:
  lastSwitchState = switchState;

  // read and scale the two axes:
  int xReading = readAxis(A0);
  int yReading = readAxis(A1);

  // if the mouse control state is active, move the mouse:
  if (mouseIsActive) {
    Mouse.move(xReading, yReading, 0);
  }

  // read the mouse button and click or not click:
  // if the mouse button is pressed:
  if (digitalRead(mouseButton) == HIGH) {
    // if the mouse is not pressed, press it:
    if (!Mouse.isPressed(MOUSE_LEFT)) {
      Mouse.press(MOUSE_LEFT);
    }
  }
  // else the mouse button is not pressed:
  else {
    // if the mouse is pressed, release it:
    if (Mouse.isPressed(MOUSE_LEFT)) {
      Mouse.release(MOUSE_LEFT);
    }
  }

  delay(responseDelay);
}

/*
  reads an axis (0 or 1 for x or y) and scales the analog input range to a range
  from 0 to <range>
*/

int readAxis(int thisAxis) {
  // read the analog input:
  int reading = analogRead(thisAxis);

  // map the reading from the analog input range to the output range:
  reading = map(reading, 0, 1023, 0, range);

  // if the output reading is outside from the rest position threshold, use it:
  int distance = reading - center;

  if (abs(distance) < threshold) {
    distance = 0;
  }

  // return the distance for this axis:
  return distance;
}

библиотека стоит, ide уже перезагружал, неработает
помогите плиз

Підвал форуму