Comments (2)
forgot to add the error (in German) :
Dieses Gerät wurde angehalten, weil es Fehler gemeldet hat. (Code 43)
Fehler bei einer Anforderung des USB-Gerätedeskriptors.
from hoodloader2.
yes I fixt it had to change the way it recived the values
#include <Mouse.h>
#include <Keyboard.h>
const int joystickCenterX = 512; // Beispielmittelpunkt des Joysticks für die X-Achse
const int joystickCenterY = 512; // Beispielmittelpunkt des Joysticks für die Y-Achse
const int joystickDeadzone = 10; // Totzone zur Vermeidung von Drift um den Mittelpunkt
const float scalingFactor = 0.05; // Skalierungsfaktor für die Mausbewegung
void setup() {
// Starten der HID-Bibliotheken
Keyboard.begin();
Mouse.begin();
// HID().begin();
// Serielle Kommunikation initialisieren
Serial1.begin(115200); // Kommunikation mit dem IO-MCU
//Serial.begin(74880); // Debugging
}
void loop() {
if (Serial1.available()) {
char zeile[100];
Serial1.readBytesUntil('\n', zeile, 100);
zeile[strlen(zeile) - 1] = '\0';
processValues(zeile);
}
}
void processValues(char* zeile) {
int values[15];
int i = 0;
// Tokenisierung des Strings
char* token = strtok(zeile, ";");
while (token != nullptr && i < 15) {
values[i] = atoi(token); // ASCII to Integer
token = strtok(nullptr, ";");
i++;
}
// Werte in Variablen zuweisen
int blinkerR = values[0];
int blinkerL = values[1];
int WarnB = values[2];
int Hand = values[3];
int Horn = values[4];
int Z0 = values[5];
int Z1 = values[6];
int Z2 = values[7];
int Z3 = values[8];
int L1 = values[9];
int Mousex = values[10];
int Mousey = values[11];
int MouseR = values[12];
int MouseL = values[13];
int MouseM = values[14];
if (blinkerR == 1) {
Keyboard.press(KEY_KP_7);
Keyboard.release(KEY_KP_7);
}
if (blinkerL == 1) {
Keyboard.press(',');
Keyboard.release(',');
}
if (WarnB == 1) {
Keyboard.press(KEY_KP_8);
Keyboard.release(KEY_KP_8);
}
if (Hand == 1) {
Keyboard.press('p');
Keyboard.release('p');
}
if (Horn == 1) {
Keyboard.press('h');
Keyboard.release('h');
}
if (Z0 == 1) {
Keyboard.press(KEY_F20);
Keyboard.release(KEY_F20);
}
if (Z1 == 1) {
Keyboard.press(KEY_F22);
Keyboard.release(KEY_F22);
}
if (Z2 == 1) {
Keyboard.press(KEY_F23);
Keyboard.release(KEY_F23);
}
if (Z3 == 1) {
Keyboard.press(KEY_F24);
Keyboard.release(KEY_F24);
}
if (L1 == 1) {
Keyboard.press('n');
Keyboard.release('n');
}
//Serial.print(Mousex);
//Serial.println(Mousey);
int deltaX = Mousex - joystickCenterX;
int deltaY = Mousey - joystickCenterY;
if (abs(deltaX) < joystickDeadzone) deltaX = 0;
if (abs(deltaY) < joystickDeadzone) deltaY = 0;
deltaY = -deltaY;
deltaX *= scalingFactor;
deltaY *= scalingFactor;
Mouse.move(deltaX, deltaY, 0);
if (MouseR == 1) {
Mouse.press(MOUSE_RIGHT);
} else {
Mouse.release(MOUSE_RIGHT);
}
if (MouseL == 1) {
Mouse.press(MOUSE_LEFT);
} else {
Mouse.release(MOUSE_LEFT);
}
if (MouseM == 1) {
Mouse.press(MOUSE_MIDDLE);
} else {
Mouse.release(MOUSE_MIDDLE);
}
from hoodloader2.
Related Issues (20)
- i dont have 2 UNO boards but i have 1 uno 1 mega HOT 1
- Add support for analog input HOT 1
- MacOS Monterey: bad CPU type in executable HOT 13
- Sent Enter/Alt/Shift command
- Image in Hoodloader wiring is a bit old? HOT 2
- How to change device Manufacturer and Product name? HOT 1
- My Arduino UNO is not connecting after failed hoodloader2 burning attempt. HOT 1
- can't turn back to original bootloader HOT 1
- Bricked bootloader HOT 1
- Can't compile for HootLoader2 on new IDE HOT 4
- Atmega16U2 incorrect PID
- Flash Bootloader HOT 1
- Error compiling program for HoodLoader2 Uno HOT 8
- FLIP Gives "Address out of range" for Arduino UNO HOT 4
- Aruino Uno Wifi Rev2 Support?
- Arduino Mega 16U2 will not self-install bootloader HOT 1
- atmega16u2 unexpectedly starts running bootloader HOT 1
- `USE_RAM_DESCRIPTORS` checks incorrectly calculate RAM usage
- Remove hoodloader ? How? Arduino Uno R3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hoodloader2.