<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — Bleutooth servo car]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=134&amp;type=atom" />
	<updated>2017-03-23T15:18:16Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=134</id>
		<entry>
			<title type="html"><![CDATA[Bleutooth servo car]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=488#p488" />
			<content type="html"><![CDATA[<p>Hello everybody,</p><p>I have a little problem with my project at school, <br />the motor and servo arent operating as I hoped.</p><p>when i slide the slider all the way to the left it keeps on going to the left,<br />when i slide it to the right it goes to the left for 0.5sec en then slow to the right</p><p>the 2 motors arent responding at all...</p><p>i&#039;m new to the arduino programming so that&#039;s why i am asking you guys to help me<br />*sorry for bad english im from holland (Netherlands)</p><p>Here is the code:</p><p>/* <br />&nbsp; &nbsp;-- New project -- <br />&nbsp; &nbsp; <br />&nbsp; &nbsp;This source code of graphical user interface&nbsp; <br />&nbsp; &nbsp;has been generated automatically by RemoteXY editor. <br />&nbsp; &nbsp;To compile this code using RemoteXY library 2.2.5 or later version&nbsp; <br />&nbsp; &nbsp;download by link <a target="_blank" href="http://remotexy.com/en/library/">http://remotexy.com/en/library/</a> <br />&nbsp; &nbsp;To connect using RemoteXY mobile app by link <a target="_blank" href="http://remotexy.com/en/download/">http://remotexy.com/en/download/</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp;- for ANDROID 3.7.1 or later version; <br />&nbsp; &nbsp; &nbsp;- for iOS 1.0.7 or later version; <br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp;This source code is free software; you can redistribute it and/or <br />&nbsp; &nbsp;modify it under the terms of the GNU Lesser General Public <br />&nbsp; &nbsp;License as published by the Free Software Foundation; either <br />&nbsp; &nbsp;version 2.1 of the License, or (at your option) any later version.&nbsp; &nbsp; &nbsp;<br />*/ </p><p>////////////////////////////////////////////// <br />//&nbsp; &nbsp; &nbsp; &nbsp; RemoteXY include library&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />////////////////////////////////////////////// </p><p>// RemoteXY select connection mode and include library&nbsp; <br />#define REMOTEXY_MODE__HARDSERIAL<br />#include &lt;Servo.h&gt;<br />Servo myservo;<br />Servo myservo_1;<br />#include &lt;SoftwareSerial.h&gt; <br />#include &lt;RemoteXY.h&gt; </p><p>// RemoteXY connection settings&nbsp; <br />#define REMOTEXY_SERIAL Serial1 <br />#define REMOTEXY_SERIAL_SPEED 9600 </p><br /><p>// RemoteXY configurate&nbsp; &nbsp;<br />#pragma pack(push, 1) <br />uint8_t RemoteXY_CONF[] = <br />&nbsp; { 5,0,58,0,6,7,0,2,0,12<br />&nbsp; ,6,22,11,2,226,152,188,0,79,70<br />&nbsp; ,70,0,1,1,54,16,12,12,2,226<br />&nbsp; ,153,171,0,2,0,12,23,22,11,2<br />&nbsp; ,226,150,178,0,226,150,188,0,4,176<br />&nbsp; ,1,46,58,9,2,4,32,80,2,8<br />&nbsp; ,57,2 }; <br />&nbsp; &nbsp;<br />// this structure defines all the variables of your control interface&nbsp; <br />struct { </p><p>&nbsp; &nbsp; // input variable<br />&nbsp; uint8_t R; // =1 if switch ON and =0 if OFF <br />&nbsp; uint8_t button_5; // =1 if button pressed, else =0 <br />&nbsp; uint8_t switch_1; // =1 if switch ON and =0 if OFF <br />&nbsp; int8_t slider_1; // =-100..100 slider position <br />&nbsp; int8_t slider_2; // =-100..100 slider position <br />&nbsp; uint8_t PIN_DIR_1A;<br />&nbsp; uint8_t PIN_DIR_1B;<br />&nbsp; uint8_t PIN_DIR_2A;<br />&nbsp; uint8_t PIN_DIR_2B;<br />&nbsp; uint8_t PIN_SPD_1;<br />&nbsp; uint8_t PIN_SPD_2;<br />&nbsp; </p><p>&nbsp; &nbsp; // other variable<br />&nbsp; uint8_t connect_flag;&nbsp; // =1 if wire connected, else =0 </p><p>} RemoteXY; <br />#pragma pack(pop) </p><p>///////////////////////////////////////////// <br />//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;END RemoteXY include&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />///////////////////////////////////////////// </p><p>#define PIN_R 13<br />#define PIN_BUTTON_5 10<br />#define PIN_SWITCH_1 A0<br />#define PIN_DIR_1A 7<br />#define PIN_DIR_1B 12<br />#define PIN_DIR_2A 11<br />#define PIN_DIR_2B 6<br />#define PIN_SPD_1 5<br />#define PIN_SPD_2 13</p><br /><p>void setup()&nbsp; <br />{ <br />&nbsp; RemoteXY_Init ();&nbsp; <br />&nbsp; myservo.attach(A1);&nbsp; <br />&nbsp; pinMode (PIN_R, OUTPUT);<br />&nbsp; pinMode (PIN_BUTTON_5, OUTPUT);<br />&nbsp; pinMode (PIN_SWITCH_1, OUTPUT);<br />&nbsp; RemoteXY.slider_1 = 0;<br />&nbsp; &nbsp;<br />&nbsp; // TODO you setup code <br />&nbsp; &nbsp;<br />} </p><p>void loop()&nbsp; <br />{&nbsp; <br />&nbsp; RemoteXY_Handler (); <br />&nbsp; &nbsp;<br />&nbsp; digitalWrite(PIN_R, (RemoteXY.R==0)?LOW:HIGH);<br />&nbsp; digitalWrite(PIN_BUTTON_5, (RemoteXY.button_5==0)?LOW:HIGH);<br />&nbsp; digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH);<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;int pos = RemoteXY.slider_2; <br />&nbsp; if (pos&gt;0) { // up <br />&nbsp; &nbsp; digitalWrite(7, HIGH);<br />&nbsp; &nbsp; digitalWrite(12, LOW);<br />&nbsp; &nbsp; digitalWrite(11, HIGH);<br />&nbsp; &nbsp; digitalWrite(6, LOW);</p><p>&nbsp; &nbsp; analogWrite(5, 255/100*RemoteXY.slider_2);&nbsp; <br />&nbsp; &nbsp; analogWrite(13, 255/100*RemoteXY.slider_2);<br />&nbsp; }&nbsp; <br />&nbsp; else if (pos&lt;0) { // down <br />&nbsp; &nbsp; <br />&nbsp; &nbsp; digitalWrite(PIN_DIR_1A, LOW);<br />&nbsp; &nbsp; digitalWrite(PIN_DIR_1B, HIGH);<br />&nbsp; &nbsp; digitalWrite(PIN_DIR_2A, LOW);<br />&nbsp; &nbsp; digitalWrite(PIN_DIR_2B, HIGH); <br />&nbsp; &nbsp; analogWrite(PIN_SPD_1, 255/100*pos); <br />&nbsp; &nbsp; analogWrite(PIN_SPD_2, (0-pos) * 2.55); <br />&nbsp; &nbsp; <br />&nbsp; }&nbsp; <br />&nbsp; else { // stop <br />&nbsp; &nbsp; digitalWrite(PIN_DIR_1A, LOW);&nbsp; <br />&nbsp; &nbsp; digitalWrite(PIN_DIR_1B, LOW);<br />&nbsp; &nbsp; digitalWrite(PIN_DIR_2A, LOW);<br />&nbsp; &nbsp; digitalWrite(PIN_DIR_2B, LOW);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; analogWrite(PIN_SPD_1, 0);&nbsp; <br />&nbsp; &nbsp; analogWrite(PIN_SPD_2, 0);<br />&nbsp; }&nbsp; <br />&nbsp; &nbsp;<br />&nbsp; {<br />&nbsp; &nbsp;int pos = RemoteXY.slider_1; <br />&nbsp; if (pos&gt;0) { // Rechts<br />&nbsp; &nbsp; analogWrite(A1, RemoteXY.slider_1 * 2.55);<br />&nbsp; &nbsp;myservo.writeMicroseconds(RemoteXY.slider_1 * 20 + 500);<br />&nbsp; }&nbsp; <br />&nbsp; else if (pos&lt;-0) { // Links <br />&nbsp; &nbsp; analogWrite(A1, RemoteXY.slider_1 * 2.55);<br />&nbsp; &nbsp;myservo.writeMicroseconds(2500 - RemoteXY.slider_1 * 20);&nbsp; <br />&nbsp; <br />&nbsp; }&nbsp; </p><br /><br /><p>&nbsp; <br />&nbsp; &nbsp;<br />&nbsp; // TODO you loop code <br />&nbsp; // use the RemoteXY structure for data transfer <br />}<br />}</p><br /><p>With kind regards, <br />Kellen</p>]]></content>
			<author>
				<name><![CDATA[kellennijman]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=273</uri>
			</author>
			<updated>2017-03-23T15:18:16Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=488#p488</id>
		</entry>
</feed>
