<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — joystick]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=112&amp;type=atom" />
	<updated>2017-02-26T12:25:38Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=112</id>
		<entry>
			<title type="html"><![CDATA[Re: joystick]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=402#p402" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>if (VELOCIDADE = 0) {</code></pre></div><p><span class="postimg"><img src="https://cdn.meme.am/cache/instances/folder823/500x/75841823.jpg" alt="https://cdn.meme.am/cache/instances/folder823/500x/75841823.jpg" /></span></p>]]></content>
			<author>
				<name><![CDATA[Guillaume]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=23</uri>
			</author>
			<updated>2017-02-26T12:25:38Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=402#p402</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: joystick]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=375#p375" />
			<content type="html"><![CDATA[<p>Maybe PIN_MOTOR used same pin that RemoteXY used for SoftSerial?<br />Please publish all sketch.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2017-02-19T18:57:06Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=375#p375</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: joystick]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=372#p372" />
			<content type="html"><![CDATA[<p>The code I post have good values in the Serial.print...<br />But is not working... maybe my mistake!!<br />But I&nbsp; can´t understand the problem of my code :s<br />Some help will be great!</p>]]></content>
			<author>
				<name><![CDATA[AS]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=237</uri>
			</author>
			<updated>2017-02-19T02:32:40Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=372#p372</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[joystick]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=371#p371" />
			<content type="html"><![CDATA[<p>Hi!<br />RemoteXY is a great solution!<br />Simple question or Issue:<br />I want to do a simple solution to use in RC cars, I want control velocity (Up and DOWN) with PWM and direction with (RIGHT and LEFT).<br />This code is for show the values in serie, it works great:</p><div class="codebox"><pre><code>void loop()  
{  
  RemoteXY_Handler (); 

VELOCIDADE = RemoteXY.joystick_1_y;
DIRECAO = RemoteXY.joystick_1_x;
  
  
  Serial.println(&quot;Y-----------------------&quot;);
  Serial.println(VELOCIDADE);
  Serial.println(&quot;X-----------------------&quot;);  
  Serial.println(DIRECAO);

  delay(100); // To see the values

}</code></pre></div><p>But if I put some if&#039;s to control, I admit I have some mistake but I no longer see the &quot;good&quot; values in the </p><div class="codebox"><pre><code>Serial.print</code></pre></div><p>My code is:<br /></p><div class="codebox"><pre><code>void loop()  
{  
  RemoteXY_Handler (); 

  VELOCIDADE = RemoteXY.joystick_1_y;
  DIRECAO = RemoteXY.joystick_1_x;
  
  
  Serial.println(&quot;Y-----------------------&quot;);
  Serial.println(VELOCIDADE);
  Serial.println(&quot;X-----------------------&quot;);  
  Serial.println(DIRECAO);


  if (VELOCIDADE &gt; 0) {
    analogWrite(PIN_MOTOR_UP, VELOCIDADE*2.55);
    analogWrite(PIN_MOTOR_DOWN, 0);    
  }

  if (VELOCIDADE = 0) {
    analogWrite(PIN_MOTOR_UP, 0);
    analogWrite(PIN_MOTOR_DOWN, 0);   
  }

  if (VELOCIDADE &lt; 0) {
    analogWrite(PIN_MOTOR_DOWN, -VELOCIDADE*2.55);
    analogWrite(PIN_MOTOR_UP, 0);      
  }


  if (DIRECAO &gt; 50) {
    digitalWrite(PIN_MOTOR_RIGHT, HIGH);
    digitalWrite(PIN_MOTOR_LEFT, LOW);    
  }

  if (DIRECAO &lt; -50) {
    digitalWrite(PIN_MOTOR_RIGHT, LOW);
    digitalWrite(PIN_MOTOR_LEFT, HIGH);    
  }

  if ((DIRECAO &lt; 50) and (DIRECAO &gt; -50)){
    digitalWrite(PIN_MOTOR_RIGHT, LOW);
    digitalWrite(PIN_MOTOR_LEFT, LOW);    
  }

}</code></pre></div><p>How I should to do to make this simple example work?<br />Thanks a lot!<br />AS</p>]]></content>
			<author>
				<name><![CDATA[AS]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=237</uri>
			</author>
			<updated>2017-02-19T02:18:53Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=371#p371</id>
		</entry>
</feed>
