<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[James's Programming Page — Have issues trying to get 16-bit joystick inputs consistently]]></title>
		<link>https://swforum.seekye.com/topic/10155/</link>
		<atom:link href="https://swforum.seekye.com/feed/rss/topic/10155/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Have issues trying to get 16-bit joystick inputs consistently.]]></description>
		<lastBuildDate>Mon, 11 Mar 2024 08:09:50 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Have issues trying to get 16-bit joystick inputs consistently]]></title>
			<link>https://swforum.seekye.com/post/13146/#p13146</link>
			<description><![CDATA[<p>Hello. As the title says, I&#039;m having trouble trying to run a 16-bit joystick/hardware. Sometimes, it works when I run the code. Sometimes it doesn&#039;t. It&#039;s inconsistent and I need help.</p><p>I have no troubles with 8-bit. Just with 16-bit joystick I&#039;m having troubles with.</p><p>Here&#039;s the code:</p><div class="codebox"><pre><code>static void Main()
{
    var list = DeviceList.Local;
    
    var joystick = list.GetHidDeviceOrNull(productID: 12345);

    if (joystick != null)
    {
        using (var stream = joystick.Open())
        {
            var inputReportBuffer = new byte[joystick.GetMaxInputReportLength()];
            while (true)
            {
                try
                {
                    int length = stream.Read(inputReportBuffer, 0, inputReportBuffer.Length);
                    Console.Write($&quot;Worked!\n&quot;);
                    Thread.Sleep(1000);
                }
                catch (Exception ex)
                {
                    Console.Write($&quot;Crashed!\n&quot;);
                    Console.WriteLine($&quot;Exception: {ex.Message}\n{ex.StackTrace}&quot;);
                }

            }
        }
    }
    else
    {
        Console.WriteLine(&quot;Joystick not found.&quot;);
    }
}</code></pre></div><p>Please help me. I really appreciate any kind of help.</p>]]></description>
			<author><![CDATA[null@example.com (zamarloveub)]]></author>
			<pubDate>Mon, 11 Mar 2024 08:09:50 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/13146/#p13146</guid>
		</item>
	</channel>
</rss>
