<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/7883" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2012-12-08T04:41:52+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/7883</id>

		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2012-12-08T04:41:52+02:00</updated>

		<published>2012-12-08T04:41:52+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=7883&amp;p=24008#p24008</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=7883&amp;p=24008#p24008"/>
		<title type="html"><![CDATA[Re: Joystick-axis]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=7883&amp;p=24008#p24008"><![CDATA[
Its a bit to get used to but not too hard. This is using the ADC's on an atmega 168/328<br /><br /><div class="codebox"><p>Code: </p><pre><code>//voltage reader.<br />#define ADC_VREF_TYPE 0x40<br />static int read_adc(unsigned char adc_input)<br />{<br />   ADMUX=adc_input|ADC_VREF_TYPE;<br />    _delay_us(150);<br />    ADCSRA|=0x40; // Start the AD conversion<br />    while ((ADCSRA &amp; 0x10)==0);// Wait for complete<br />    ADCSRA|=0x10;<br />    return ADCW;<br />} <br /></code></pre></div><br /><br /><br />the init would be <br /><br /><div class="codebox"><p>Code: </p><pre><code>   ADMUX=0x1;//ADC init<br />   ADCSRA=0x83;</code></pre></div><br /><br />and you  would read in to a report like so - natural your math will be different. <br /><br /><div class="codebox"><p>Code: </p><pre><code>      reportBuffer&#91;1&#93;= (read_adc(0)/3 + 200);//pc0<br />      reportBuffer&#91;2&#93;= (read_adc(1)/3 + 200)*-1;//pc1</code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Sat Dec 08, 2012 4:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2012-12-07T18:09:52+02:00</updated>

		<published>2012-12-07T18:09:52+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=7883&amp;p=23997#p23997</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=7883&amp;p=23997#p23997"/>
		<title type="html"><![CDATA[Joystick-axis]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=7883&amp;p=23997#p23997"><![CDATA[
Hi,<br />i read this tutorial: <!-- m --><a class="postlink" href="http://codeandlife.com/2012/01/22/avr-attiny-usb-tutorial-part-1/">http://codeandlife.com/2012/01/22/avr-a ... al-part-1/</a><!-- m --> , and the same author wrote a How-To for making an USB-Keyboard via the HID-class, which worked wonderful for me  <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":)" title="Smile" />  Now i´m wondering how to get the output of my ADC to a joystick-axis recognized in the windows &quot;USB- and Gamecontrollers&quot;-dialogue... Thanks in advance,<br /><br />Slot<p>Statistics: Posted by Guest — Fri Dec 07, 2012 6:09 pm</p><hr />
]]></content>
	</entry>
	</feed>
