I want to communicate from a simple windows console app with Teensy 3.6 with usb type flight sim controls. Using the Arduino (v1.8.13) serial monitor & port set to emulated serial hid#vid16c0&pid0488 everything works as expected.
I have tried to write a windows console application to communicate with the Teensy. After a quick search on how to do this things got very complicated very quickly with lots of code examples many pages long on handling HID/USB. Mostly well beyond my ability to understand the code.
I have downloaded TeensySharp from https://github.com/luni64/TeensySharp. This is well documented so I have a chance to understand it. I have used MS Visual studio 2019 and the Teensywatcher console example which compiles and runs with no errors My Teensey boards do not appear in the output and I am at a loss as to why.
I have found a program HIDSharp by James F. Bellinger https://www.zer7.com/software/hidsharp This runs and outputs a list of all USB devices and sees Teensy boards. Unfortunaely it is to advanced for me to understand the code.
As always any guidance suggestions greatly appreciated.
Have included my Arduino code for completeness. Ultimately I hope to do a little more than this.
/
I have tried to write a windows console application to communicate with the Teensy. After a quick search on how to do this things got very complicated very quickly with lots of code examples many pages long on handling HID/USB. Mostly well beyond my ability to understand the code.
I have downloaded TeensySharp from https://github.com/luni64/TeensySharp. This is well documented so I have a chance to understand it. I have used MS Visual studio 2019 and the Teensywatcher console example which compiles and runs with no errors My Teensey boards do not appear in the output and I am at a loss as to why.
I have found a program HIDSharp by James F. Bellinger https://www.zer7.com/software/hidsharp This runs and outputs a list of all USB devices and sees Teensy boards. Unfortunaely it is to advanced for me to understand the code.
As always any guidance suggestions greatly appreciated.
Have included my Arduino code for completeness. Ultimately I hope to do a little more than this.
/
Code:
*
Name: TestSerialonArduino.ino
Created: 26/01/2021 1:10:28 PM
Author: John
*/
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
}
// the loop function runs over and over again until power down or reset
void loop() {
String readstring;
String Q;
//------------------------check serial port ----------------
while (Serial.available()) {
delay(5);
if (Serial.available() > 0) {
char c = Serial.read(); // gets single byte from buffer
if (isControl(c)) {
break;
}
readstring += c; // makes string readString
}
}
Q = readstring;
if (Q == "on")
{
Serial.println("Flaps downn");
digitalWrite(13, HIGH);
}
if (Q == "off")
{
Serial.println("Flaps up");
digitalWrite(13, LOW);
}
}