<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — Некорректно работает скетч!]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=372&amp;type=atom" />
	<updated>2018-01-28T19:22:29Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=372</id>
		<entry>
			<title type="html"><![CDATA[Re: Некорректно работает скетч!]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1289#p1289" />
			<content type="html"><![CDATA[<p>спасибо огромное)))) капал совсем в другую сторону)))<br />все заработало азы азов))</p>]]></content>
			<author>
				<name><![CDATA[alim62]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=538</uri>
			</author>
			<updated>2018-01-28T19:22:29Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1289#p1289</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Некорректно работает скетч!]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1286#p1286" />
			<content type="html"><![CDATA[<p>Ответ на ваш вопрос есть в описании библиотеки servo.h,<br />например тут <a target="_blank" href="http://arduino.ru/Reference/Library/Servo">http://arduino.ru/Reference/Library/Servo</a><br />На контроллерах отличных от Mega использование библиотеки отключает возможность использовать выходы 9 и 10 в режиме ШИМ даже если привод не подключен к этим выводам.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2018-01-28T17:48:13Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1286#p1286</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Некорректно работает скетч!]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1285#p1285" />
			<content type="html"><![CDATA[<p>пробовал и так тоже, а мб что то с hm10?</p>]]></content>
			<author>
				<name><![CDATA[alim62]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=538</uri>
			</author>
			<updated>2018-01-28T14:18:31Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1285#p1285</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Некорректно работает скетч!]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1284#p1284" />
			<content type="html"><![CDATA[<p>В скетче вижу только одну севу, а где вторая, или из за нее все и сбоит?, А вообще попробуй управление слайдером изменить</p><p>int8_t strela; // =-100..100 положение слайдера -&nbsp; на от 0 до 100<br />int8_t kovsh; // =-100..100 положение слайдера - на от 0 до 100</p>]]></content>
			<author>
				<name><![CDATA[olegeglit]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=497</uri>
			</author>
			<updated>2018-01-28T13:16:16Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1284#p1284</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Некорректно работает скетч!]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1282#p1282" />
			<content type="html"><![CDATA[<p>пробовал не получается, если подключать все отдельно(разными скетчами) то работает нормально! а вместе не хочет(((</p>]]></content>
			<author>
				<name><![CDATA[alim62]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=538</uri>
			</author>
			<updated>2018-01-28T10:35:32Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1282#p1282</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Некорректно работает скетч!]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1281#p1281" />
			<content type="html"><![CDATA[<p>Возможно вам поможет эта информация<br /><a target="_blank" href="http://forum.remotexy.com/viewtopic.php?id=9">http://forum.remotexy.com/viewtopic.php?id=9</a></p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2018-01-28T07:09:47Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1281#p1281</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Некорректно работает скетч!]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1280#p1280" />
			<content type="html"><![CDATA[<p>Добрый день, не могу понять почему при добавлении настроек сервоприводов скетч перестает адекватно работать?<br />Плата arduino pro mini и bluetooth HM-10<br />Скетч для погрузчика на две сервы и два мотора</p><br /><br /><p>////////////////////////////////////////////// <br />//&nbsp; &nbsp; &nbsp; &nbsp; RemoteXY include library&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <br />////////////////////////////////////////////// </p><p>// определение режима соединения и подключение библиотеки RemoteXY&nbsp; <br />#define REMOTEXY_MODE__SOFTSERIAL<br />#include &lt;SoftwareSerial.h&gt; <br />#include &lt;Servo.h&gt; <br />#include &lt;RemoteXY.h&gt; </p><p>// настройки соединения&nbsp; <br />#define REMOTEXY_SERIAL_RX 16 <br />#define REMOTEXY_SERIAL_TX 3 <br />#define REMOTEXY_SERIAL_SPEED 9600 </p><br /><p>// конфигурация интерфейса&nbsp; &nbsp;<br />#pragma pack(push, 1) <br />uint8_t RemoteXY_CONF[] = <br />&nbsp; { 255,7,0,0,0,217,0,8,79,0,<br />&nbsp; 5,32,52,13,47,47,2,26,19,4,<br />&nbsp; 48,3,11,9,51,89,26,4,48,17,<br />&nbsp; 11,9,51,89,26,2,0,31,31,19,<br />&nbsp; 8,2,26,31,31,79,78,0,79,70,<br />&nbsp; 70,0,2,0,31,16,19,8,2,26,<br />&nbsp; 31,31,79,78,0,79,70,70,0,2,<br />&nbsp; 0,31,47,19,8,2,26,31,31,79,<br />&nbsp; 78,0,79,70,70,0,129,0,30,11,<br />&nbsp; 20,4,1,208,147,208,176,208,177,208,<br />&nbsp; 176,209,128,208,184,209,130,209,139,0,<br />&nbsp; 129,0,31,25,19,4,1,208,144,208,<br />&nbsp; 178,208,176,209,128,208,184,208,185,208,<br />&nbsp; 186,208,176,0,129,0,28,41,25,4,<br />&nbsp; 1,208,158,209,133,208,187,208,176,208,<br />&nbsp; 182,208,180,208,181,208,189,208,184,208,<br />&nbsp; 181,0,129,0,26,0,46,9,64,208,<br />&nbsp; 159,208,190,208,179,209,128,209,131,208,<br />&nbsp; 183,209,135,208,184,208,186,0,129,0,<br />&nbsp; 2,9,11,3,36,208,161,209,130,209,<br />&nbsp; 128,208,181,208,187,208,176,0,129,0,<br />&nbsp; 15,9,8,3,36,208,154,208,190,208,<br />&nbsp; 178,209,136,0 }; <br />&nbsp; &nbsp;<br />// структура определяет все переменные вашего интерфейса управления&nbsp; <br />struct { </p><p>&nbsp; &nbsp; // input variable<br />&nbsp; int8_t joystick_1_x; // =-100..100 координата x положения джойстика <br />&nbsp; int8_t joystick_1_y; // =-100..100 координата y положения джойстика <br />&nbsp; int8_t strela; // =-100..100 положение слайдера <br />&nbsp; int8_t kovsh; // =-100..100 положение слайдера <br />&nbsp; uint8_t avar; // =1 если переключатель включен и =0 если отключен <br />&nbsp; uint8_t gabariti; // =1 если переключатель включен и =0 если отключен <br />&nbsp; uint8_t cooler; // =1 если переключатель включен и =0 если отключен </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>/* определяем пины управления правым мотором */ <br />#define PIN_MOTOR_RIGHT_UP 7 <br />#define PIN_MOTOR_RIGHT_DN 6 <br />#define PIN_MOTOR_RIGHT_SPEED 10 </p><p>/* определяем пины управления левым мотором */ <br />#define PIN_MOTOR_LEFT_UP 5 <br />#define PIN_MOTOR_LEFT_DN 4 <br />#define PIN_MOTOR_LEFT_SPEED 9 </p><p>#define PIN_AVAR A3<br />#define PIN_GABARITI 13<br />#define PIN_COOLER A5</p><p>Servo myservo; </p><br /><p>/* определяем два массива с перечислением пинов для каждого мотора */ <br />unsigned char RightMotor[3] =&nbsp; <br />&nbsp; {PIN_MOTOR_RIGHT_UP, PIN_MOTOR_RIGHT_DN, PIN_MOTOR_RIGHT_SPEED}; <br />unsigned char LeftMotor[3] =&nbsp; <br />&nbsp; {PIN_MOTOR_LEFT_UP, PIN_MOTOR_LEFT_DN, PIN_MOTOR_LEFT_SPEED}; </p><p>/* <br />&nbsp; &nbsp;управление скоростью мотора <br />&nbsp; &nbsp;motor - ссылка на массив пинов <br />&nbsp; &nbsp;v - скорость мотора, может принимать значения от -100 до 100 <br />*/ <br />void Wheel (unsigned char * motor, int v) <br />{ <br />&nbsp; if (v&gt;100) v=100; <br />&nbsp; if (v&lt;-100) v=-100; <br />&nbsp; if (v&gt;0) { <br />&nbsp; &nbsp; digitalWrite(motor[0], HIGH); <br />&nbsp; &nbsp; digitalWrite(motor[1], LOW); <br />&nbsp; &nbsp; analogWrite(motor[2], v*2.55); <br />&nbsp; } <br />&nbsp; else if (v&lt;0) { <br />&nbsp; &nbsp; digitalWrite(motor[0], LOW); <br />&nbsp; &nbsp; digitalWrite(motor[1], HIGH); <br />&nbsp; &nbsp; analogWrite(motor[2], (-v)*2.55); <br />&nbsp; } <br />&nbsp; else { <br />&nbsp; &nbsp; digitalWrite(motor[0], LOW); <br />&nbsp; &nbsp; digitalWrite(motor[1], LOW); <br />&nbsp; &nbsp; analogWrite(motor[2], 0); <br />&nbsp; } <br />} <br />void setup()&nbsp; <br />{ <br />&nbsp; RemoteXY_Init (); <br />&nbsp; &nbsp;<br />&nbsp; myservo.attach(11);&nbsp; <br />&nbsp; RemoteXY.kovsh = 80;<br />&nbsp; <br /> /* инициализация пинов */ <br />&nbsp; pinMode (PIN_MOTOR_RIGHT_UP, OUTPUT); <br />&nbsp; pinMode (PIN_MOTOR_RIGHT_DN, OUTPUT); <br />&nbsp; pinMode (PIN_MOTOR_LEFT_UP, OUTPUT); <br />&nbsp; pinMode (PIN_MOTOR_LEFT_DN, OUTPUT); <br />&nbsp; pinMode (PIN_AVAR, OUTPUT);<br />&nbsp; pinMode (PIN_GABARITI, OUTPUT);<br />&nbsp; pinMode (PIN_COOLER, OUTPUT);<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_AVAR, (RemoteXY.avar==0)?LOW:HIGH);<br />&nbsp; digitalWrite(PIN_GABARITI, (RemoteXY.gabariti==0)?LOW:HIGH);<br />&nbsp; digitalWrite(PIN_COOLER, (RemoteXY.cooler==0)?LOW:HIGH);<br />&nbsp; &nbsp;<br /> /* управляем правым мотором */ <br />&nbsp; Wheel (RightMotor, RemoteXY.joystick_1_y - RemoteXY.joystick_1_x); <br />&nbsp; /* управляем левым мотором */ <br />&nbsp; Wheel (LeftMotor, RemoteXY.joystick_1_y + RemoteXY.joystick_1_x); </p><br /><p>int ms = RemoteXY.kovsh;&nbsp; <br />&nbsp; ms = map(ms, 0, 100, 50, 100); <br />&nbsp; myservo.write(ms);&nbsp; </p><p>}</p>]]></content>
			<author>
				<name><![CDATA[alim62]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=538</uri>
			</author>
			<updated>2018-01-28T01:23:51Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1280#p1280</id>
		</entry>
</feed>
