-
Arduino Code
11/25/2015 at 10:29 • 0 commentsFor all of you who want to rebuild this at home.
This sketch controls a 7-segment display as a gear indicator and simulates a keypress when corresponding data is being received through the Arduino's serial port.
The display is able to show: r (reverse), n (neutral), 1, 2, 3, 4, 5, 6
// Eine 7-Segment Anzeige ansteuern // // Matthias Busse Version 1.0 vom 30.11.2014 // 7-Segment a-f und der Punk h // -a- // f b // -g- // e c // -d- h // a > D2 // b > D3 // c > D4 // d > D5 // e > D6 // f > D7 // g > D8 // h > D9 int j=1; // R N 1 2 3 4 5 6 7 8 9 10 11 12 //byte z[14]={B00001010, B00101010, B01100000, B11011010, B11110010, B01100110, B10110110, B10111110, B11100000, B11111110, B11110110, B11111101, B01100001, B11011011}; // R N 1 2 3 4 5 6 byte z[8]={B00001010, B00101010, B01100000, B11011010, B11110010, B01100110, B10110110, B10111110}; void setup() { for (int i=2; i <= 9; i++) // 2-9 sind Ausgänge pinMode(i,OUTPUT); // open the serial port: Serial.begin(9600); // initialize control over the keyboard: Keyboard.begin(); } void loop() { segmente(z[j]); // check for incoming serial data: if (Serial.available() > 0) { // read incoming serial data: char inChar = Serial.read(); // Type the next ASCII value from what you received: if ((inChar == 'p') && (j < 7)) { Keyboard.press(0x81); delay(100); Keyboard.releaseAll(); j++; segmente(z[j]); } if ((inChar == 'm') && (j > 0)) { Keyboard.press(0x80); delay(100); Keyboard.releaseAll(); j--; segmente(z[j]); } } } void segmente(byte n) { // alle 7 Segmente ansteuern for(int k=2; k <= 9; k++) { if((n & B10000000) > 0) digitalWrite(k, HIGH); else digitalWrite(k, LOW); n = n << 1; } }
-
Arduino micro connection works!
08/03/2015 at 11:05 • 0 commentsWith the use of the Arduino Example "KeyboardSerial" it's possible to send a serial command to the Arduino which converts the signal to a virtual Keystroke.
In this way my Compatibility Tool is able to send a serial byte to the Arduino and this will send the Keystroke to the game you're playing.
I hope it'll work after editing my Program in Delphi!
-
Compatibility Tool recognizes the actual shifter position
08/02/2015 at 07:58 • 0 commentsWith the use of the DXJoystick Component from Winsoft XE for Delphi I am able to display the gear in the Compatibility Tool which is a good start. The tool also knows when I shift from a lower gear to a higher and should then send a signal to the Arduino micro and this should send an emulated keystroke to the Racing Game or Simulator you're playing with at the moment.