Air mouse is a tool used to manage the mouse of a tool similar to a pc, cellular, sensible TVetc. On this challenge, the air mouse is made utilizing an IndusBoard coin machine.
IndusBoard Coin has varied built-in sensors similar to accelerometer, magnetometer, temperature sensor and so on. For the air mouse, an accelerometer is used. This sensor detects the place of the board which is carried out to make an air mouse by detecting the change in output readings.
Moreover, left and proper clicks may also be launched by connecting the pins of the board with exterior buttons.
S. no. | Title | Description | Quantity |
1. | IndusBoard Coin | 3cm sized dev board | 1 |
2. | System (laptop computer) | A Laptop computer or different mouse-operated machine is required. | 1 |
3. | USB cable | Required to attach IndusBoard to the machine. | 1 |
4. | Push button | For left and proper click on. | 2 |
5. | Jumper wires | To attach push buttons to the board. | 3 |
#embrace <LSM303AGR_ACC_Sensor.h>
#embrace <Wire.h>
#embrace <MPU6050.h>
#embrace "USB.h"
#embrace "USBHIDMouse.h"
USBHIDMouse Mouse;
MPU6050 mpu();
#if outlined(ARDUINO_SAM_DUE)
#outline DEV_I2C Wire1 //Outline which I2C bus is used. Wire1 for the Arduino Due
#outline SerialPort Serial
#else
#outline DEV_I2C Wire //Or Wire
#outline SerialPort Serial
#endif
// Elements.
LSM303AGR_ACC_Sensor Acc(&DEV_I2C);
// sensors_event_t occasion;
// mpu.getEvent(&occasion);
// float x = occasion.acceleration.x;
// float y = occasion.acceleration.y;
const int leftButtonPin = 2; // Pin related to the left button
const int rightButtonPin = 3; // Pin related to the best button
void setup() {
// Led.
// pinMode(13, OUTPUT);
// Initialize serial for output.
Serial.start(115200);
Mouse.start();
USB.start();
Wire.start();
// if (!mpu.start()) { // Initialize MPU6050
// Serial.println("Failed to search out MPU6050 chip");
// whereas (1) {
// delay(10);
// }
// }
// Initialize I2C bus.
DEV_I2C.start();
// mpu.calcGyroOffsets(true); // Calibrate and print offsets
pinMode(leftButtonPin, INPUT_PULLUP);
pinMode(rightButtonPin, INPUT_PULLUP);
// Initlialize elements.
Acc.start();
Acc.Allow();
}
void loop() {
// Led blinking.
// digitalWrite(13, HIGH);
// delay(250);
// digitalWrite(13, LOW);
// delay(250);
// Learn accelerometer LSM303AGR.
int32_t accelerometer[3];
Acc.GetAxes(accelerometer);
// mpu.replace(); // Replace MPU6050 information
// // Learn accelerometer values
float accelX = accelerometer[0]; // X-axis
float accelY = accelerometer[1]; // Y-axis
// Map accelerometer values to mouse actions
float mouseX = (float)(accelX * 0.01); // Modify scaling issue as wanted
float mouseY = (float)(accelY * 0.01); // Modify scaling issue as wanted
Mouse.transfer(mouseX,mouseY);
int leftButtonState = digitalRead(leftButtonPin);
int rightButtonState = digitalRead(rightButtonPin);
if (leftButtonState == LOW) { // Verify if left button is pressed
Mouse.click on(MOUSE_LEFT); // Ship left click on
delay(50); // Debounce delay
}
if (rightButtonState == LOW) { // Verify if proper button is pressed
Mouse.click on(MOUSE_RIGHT); // Ship proper click on
delay(50); // Debounce delay
}
// Output information.
// SerialPort.print("| Acc[mg]: ");
// SerialPort.print(accelerometer[0]);
// SerialPort.print(" ");
// SerialPort.print(accelerometer[1]);
// SerialPort.print(" ");
// SerialPort.print(accelerometer[2]);
// SerialPort.println(" |");
// for extra smoothness
if (abs(mouseX) > 2 || abs(mouseY) > 2) { // Modify threshold as wanted
Mouse.transfer(mouseX, mouseY);
}
delay(20); // for clean motion
}
Creator(s): Manjeet Vishwakarma, Abhay Verma and Satywanti Kundu are B.Tech ECE college students at GJUS&T HISAR
👇Observe extra 👇
👉 bdphone.com
👉 ultraactivation.com
👉 trainingreferral.com
👉 shaplafood.com
👉 bangladeshi.assist
👉 www.forexdhaka.com
👉 uncommunication.com
👉 ultra-sim.com
👉 forexdhaka.com
👉 ultrafxfund.com
👉 ultractivation.com
👉 bdphoneonline.com
POCO continues to make one of the best funds telephones, and the producer is doing…
- Commercial - Designed for players and creators alike, the ROG Astral sequence combines excellent…
Good garments, also referred to as e-textiles or wearable expertise, are clothes embedded with sensors,…
Completely satisfied Halloween! Have fun with us be studying about a number of spooky science…
Digital potentiometers (“Dpots”) are a various and helpful class of digital/analog elements with as much…
Keysight Applied sciences pronounces the enlargement of its Novus portfolio with the Novus mini automotive,…