Paso 5: Codificación... a arduino Leonardo
MySerial SoftwareSerial (10, 11); RX, TX
void setup() {}
Serial.Begin(9600);
mientras (!. Serie) {}
Keyboard.Begin (); mySerial. begin(9600);
}
}
void loop() {}
usar el serial para el control del ratón:
Si (disponibles ()) {} de mySerial.
inChar int = mySerial. leer ();
interruptor (inChar) {}
caso '1':
Keyboard.Press('m'); Delay(100);
Keyboard.Release('m');
rotura;
caso '2':
Keyboard.Press(KEY_LEFT_ARROW); Keyboard.Press('s');DELAY(300); Keyboard.Release(KEY_LEFT_ARROW); Keyboard.Release('S');
rotura;
Case '3':
Keyboard.Press(KEY_RIGHT_ARROW); Keyboard.Press('s');DELAY(300); Keyboard.Release(KEY_RIGHT_ARROW); Keyboard.Release('S');
rotura;
caso '4':
Keyboard.Press('s'); Delay(500); Keyboard.Release('S');
rotura;
caso '5':
Keyboard.Press(KEY_RIGHT_ARROW); Delay(500); Keyboard.Release(KEY_RIGHT_ARROW);
rotura;
caso '6':
Keyboard.Press(KEY_LEFT_ARROW); Delay(500); Keyboard.Release(KEY_LEFT_ARROW);
rotura;
}
}
}