Чт апр 30, 2020 20:01:57
/**
* Reads X/Y values from a PS/2 mouse connected to an Arduino
* using the PS2Mouse library available from
* http://github.com/kristopher/PS2-Mouse-Arduino/
* Original by Kristopher Chambers <kristopher.chambers@gmail.com>
* Updated by Jonathan Oxer <jon@oxer.com.au>
*/
#include "PS2Mouse.h"
#define MOUSE_DATA 5
#define MOUSE_CLOCK 6
PS2Mouse mouse(MOUSE_CLOCK, MOUSE_DATA, STREAM);
/**
* Setup
*/
void setup()
{
Serial.begin(38400);
mouse.initialize();
}
void printBinary(byte inByte)
{
for (int b = 7; b >= 0; b--)
{
Serial.print(bitRead(inByte, b));
}
}
/**
* Main program loop
*/
void loop()
{
int16_t data[3];
mouse.report(data);
printBinary(data[0]); // Status Byte
Serial.print(":");
Serial.print(data[1]); // X Movement Data
Serial.print(",");
Serial.print(data[2]); // Y Movement Data
Serial.println();
}
Ср май 13, 2020 17:46:58
Сб авг 08, 2020 23:21:43
Вс авг 09, 2020 09:19:51
Вс авг 09, 2020 12:37:17
Пн авг 10, 2020 05:34:09
Пн дек 28, 2020 20:11:11
Вт ноя 02, 2021 00:17:56
Вт ноя 02, 2021 11:48:41
Вт ноя 02, 2021 12:48:10
Вт ноя 02, 2021 17:12:53