Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Teensy Sharp watcher not seeing Teensy 3.6 boards

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    2

    Teensy Sharp watcher not seeing Teensy 3.6 boards

    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.

    Click image for larger version. 

Name:	HIDSharp output.jpg 
Views:	15 
Size:	118.4 KB 
ID:	23660

    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);
    	}
    
    
    }

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,220
    If you do it this way, it's just a com port - no complicated HID Stuff.
    You can check this by using a simple terminal program.

    My suggestions for this:
    So first try it simple: open the comport with the right number (Arduino shows it) - this should work (make sure to have the Arduino serial monitor closed)
    You can try more advanced things after that..

    Edit: Ooops... forget that... flight sim-... have not read that.
    Sorry, I have no experience with that. Forget my Text above.

    Perhaps take a look at the FlightSim examples.

  3. #3
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,422
    Quote Originally Posted by John E B View Post
    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.
    The published version of TeensySharp is quite old and doesn't detect all USB Types. There is a much newer version in the development branch which should work with FlightSim, but it still has some rough edges (need to finalize this sometime...). Anyway, it is quite simple to communicate via RawHID in C#. The user WIKI contains some examples: https://github.com/TeensyUser/doc/wiki/Raw-HID.


    Converting the examples to SerEMU should be straight forward. Changing the VID to Flightsim and the usage/usage page from RawHID to SerEMU should do the trick. Let me know if you need help with it.

  4. #4
    Junior Member
    Join Date
    Feb 2021
    Posts
    2
    Luni Thanks for your reply. I will take a look at the newer version and have a read through the wiki. It might take me a while to get to understand all this but I will let you know how I get on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •