5x 32bit words at 10Khz.
using HidLibrary;
using System;
using System.Linq;
namespace hid2
{
class Program
{
static void Main(string[] args)
{
var teensy = HidDevices.Enumerate(0x16C0, 0x0486).Where(d => d.Capabilities.Usage == 512).FirstOrDefault();
while (teensy != null)
{
var report = teensy.ReadReport();
Console.WriteLine(report.Data[0]);
}
}
}
}
#include "Arduino.h"
uint8_t buf[64];
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
byte cnt = 0;
void loop()
{
buf[0] = cnt++;
usb_rawhid_send(buf, 1000);
digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN));
delay(500);
}
You might also consider the fact that "real time" display of data does not mean 0ms latency, because a typical display only shows a new frame every 16.667ms (at 60 Hz frame rate).
Even audio has a latency, although it varies based on the buffer size (and OS too, I guess).
Even if you use custom hardware, us humans tend not to notice a latency or timing discrepancy of a few milliseconds at all. So, strive for good and practical, not for perfect.
HID is limited to 64kB /s. 5x32bit @ 10kHz gives 200kB/s that is going to be difficult
I didn't know that limitation.. so UART at 1M baud would be better?
using System;
using System.IO.Ports;
namespace test
{
class Program
{
static void Main(string[] args)
{
SerialPort port = new SerialPort("COM27"); // See https://github.com/luni64/TeensySharp if you need to autodetect the teensy port
port.Open();
while (!Console.KeyAvailable)
{
Console.WriteLine(port.ReadLine());
}
port.Close();
port.Dispose();
}
}
}
#include "Arduino.h"
void setup()
{
}
void loop()
{
Serial.printf("Test: %d\n", millis());
}
I didn't know that limitation.. so UART at 1M baud would be better?