<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.linksprite.com/index.php?action=history&amp;feed=atom&amp;title=Project_Joystick_Sensor_Module</id>
	<title>Project Joystick Sensor Module - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.linksprite.com/index.php?action=history&amp;feed=atom&amp;title=Project_Joystick_Sensor_Module"/>
	<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=Project_Joystick_Sensor_Module&amp;action=history"/>
	<updated>2026-09-10T12:59:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.linksprite.com/index.php?title=Project_Joystick_Sensor_Module&amp;diff=478&amp;oldid=prev</id>
		<title>Jingfeng: Created page with &quot;&lt;syntaxhighlight lang=&quot;c&quot;&gt;  /*   Analog input, analog output, serial output   Reads two analog input pins; a T000030 Jopystick Module Analog Sensor connected to I0 and I1, map...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.linksprite.com/index.php?title=Project_Joystick_Sensor_Module&amp;diff=478&amp;oldid=prev"/>
		<updated>2012-11-24T05:08:31Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;  /*   Analog input, analog output, serial output   Reads two analog input pins; a T000030 Jopystick Module Analog Sensor connected to I0 and I1, map...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
  Analog input, analog output, serial output&lt;br /&gt;
&lt;br /&gt;
 Reads two analog input pins; a T000030 Jopystick Module Analog Sensor connected to I0 and I1, maps the result to a range from 0 to 255&lt;br /&gt;
 and uses the result to set the pulsewidth modulation (PWM) two T010111 LED Module connected on O0 and O1.&lt;br /&gt;
 Also prints the results to the serial monitor.&lt;br /&gt;
&lt;br /&gt;
 created  7 dec 2010&lt;br /&gt;
 by Davide Gomba &lt;br /&gt;
&lt;br /&gt;
 This example code is in the public domain.&lt;br /&gt;
&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
 #define O0 11&lt;br /&gt;
 #define O1 10&lt;br /&gt;
 #define O2 9&lt;br /&gt;
 #define O3 6&lt;br /&gt;
 #define O4 5&lt;br /&gt;
 #define O5 3&lt;br /&gt;
 #define I0 A0&lt;br /&gt;
 #define I1 A1&lt;br /&gt;
 #define I2 A2&lt;br /&gt;
 #define I3 A3&lt;br /&gt;
 #define I4 A4&lt;br /&gt;
 #define I5 A5&lt;br /&gt;
&lt;br /&gt;
// These constants won't change.  They're used to give names&lt;br /&gt;
// to the pins used:&lt;br /&gt;
const int analogInPin1 = I0;  // Analog input pin that the Joystick's first pin is attached to&lt;br /&gt;
const int analogInPin2 = I1;  // Analog input pin that the Joystick's second pin is attached to&lt;br /&gt;
&lt;br /&gt;
const int analogOutPin1= O0; // Analog output pin that the LED is attached to&lt;br /&gt;
const int analogOutPin2= O1; // Analog output pin that the LED is attached to&lt;br /&gt;
&lt;br /&gt;
int sensorValue1 = 0;        // value read from the Joystick's first pin&lt;br /&gt;
int sensorValue2 = 0;        // value read from the Joystick's second pin&lt;br /&gt;
&lt;br /&gt;
int outputValue1 = 0;        // value output to the PWM (analog out)&lt;br /&gt;
int outputValue2 = 0;        // value output to the PWM (analog out)&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  // initialize serial communications at 9600 bps:&lt;br /&gt;
  Serial.begin(9600); &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
  // read the both analog in values:&lt;br /&gt;
  sensorValue1 = analogRead(analogInPin1);  &lt;br /&gt;
  sensorValue2 = analogRead(analogInPin2);  &lt;br /&gt;
  // map it to the range of the analog out:&lt;br /&gt;
  outputValue1 = map(sensorValue1, 0, 1023, 0, 255);  &lt;br /&gt;
  outputValue2 = map(sensorValue2, 0, 1023, 0, 255); &lt;br /&gt;
  // change the analog out value:&lt;br /&gt;
  analogWrite(analogOutPin1, outputValue1);    &lt;br /&gt;
  analogWrite(analogOutPin2, outputValue2);   &lt;br /&gt;
&lt;br /&gt;
  // print the results to the serial monitor:&lt;br /&gt;
  Serial.print(&amp;quot;Joystick X = &amp;quot; );                       &lt;br /&gt;
  Serial.print(sensorValue1);   &lt;br /&gt;
  Serial.print(&amp;quot;\t Joystick Y = &amp;quot; );                       &lt;br /&gt;
  Serial.print(sensorValue2);     &lt;br /&gt;
  Serial.print(&amp;quot;\t output 1 = &amp;quot;);      &lt;br /&gt;
  Serial.print(outputValue1);   &lt;br /&gt;
  Serial.print(&amp;quot;\t output 2 = &amp;quot;);      &lt;br /&gt;
  Serial.println(outputValue2);&lt;br /&gt;
&lt;br /&gt;
  // wait 10 milliseconds before the next loop&lt;br /&gt;
  // for the analog-to-digital converter to settle&lt;br /&gt;
  // after the last reading:&lt;br /&gt;
  delay(10);                     &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jingfeng</name></author>
		
	</entry>
</feed>