<?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=1814&amp;type=atom" />
	<updated>2024-06-14T21:37:05Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=1814</id>
		<entry>
			<title type="html"><![CDATA[Re: код для бесколлекторного моторчика]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5586#p5586" />
			<content type="html"><![CDATA[<p>я не совсем понял о чем вы говорите, попробовал найти по отдельности действия о которых вы говорите нашёл подобный код и переделал под себя. но не заработало(</p><br /><p>код:</p><p>#include &lt;Servo.h&gt;</p><p>/*<br />&nbsp; &nbsp;-- New project1 --<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;This source code of graphical user interface <br />&nbsp; &nbsp;has been generated automatically by RemoteXY editor.<br />&nbsp; &nbsp;To compile this code using RemoteXY library 3.1.13 or later version <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 4.13.13 or later version;<br />&nbsp; &nbsp; &nbsp;- for iOS 1.10.3 or later version;<br />&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; <br />*/</p><p>//////////////////////////////////////////////<br />//&nbsp; &nbsp; &nbsp; &nbsp; RemoteXY include library&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //<br />//////////////////////////////////////////////</p><p>// можете включить вывод отладочной информации в Serial на 115200<br />//#define REMOTEXY__DEBUGLOG&nbsp; &nbsp; </p><p>// определение режима соединения и подключение библиотеки RemoteXY <br />#define REMOTEXY_MODE__HARDSERIAL</p><br /><p>// настройки соединения <br />#define REMOTEXY_SERIAL Serial<br />#define REMOTEXY_SERIAL_SPEED 9600</p><br /><p>#include &lt;RemoteXY.h&gt;</p><p>// конфигурация интерфейса RemoteXY&nbsp; <br />#pragma pack(push, 1)&nbsp; <br />uint8_t RemoteXY_CONF[] =&nbsp; &nbsp;// 45 bytes<br />&nbsp; { 255,2,0,0,0,38,0,17,0,0,0,13,2,106,200,200,84,1,1,2,<br />&nbsp; 0,4,16,22,27,81,17,53,78,14,176,94,26,4,18,152,73,24,150,2,<br />&nbsp; 17,71,0,37,26 };<br />&nbsp; <br />// структура определяет все переменные и события вашего интерфейса управления <br />struct {</p><p>&nbsp; &nbsp; // input variables<br />&nbsp; int8_t slider_01; // oт -100 до 100</p><br /><p>&nbsp; &nbsp; // other variable<br />&nbsp; uint8_t connect_flag;&nbsp; // =1 if wire connected, else =0</p><p>} RemoteXY;&nbsp; &nbsp;<br />#pragma pack(pop)</p><p>/////////////////////////////////////////////<br />//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;END RemoteXY include&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //<br />/////////////////////////////////////////////<br />unit32_t myTimer;<br />Servo myservo;</p><p>void setup() <br />{<br />&nbsp; RemoteXY_Init (); <br />&nbsp; myservo.attach(3);</p><br /><br /><br /><p>&nbsp; // TODO you setup code<br />&nbsp; <br />}</p><p>void loop() <br />{ <br />&nbsp; RemoteXY_Handler ();<br />&nbsp; if (millis() - myTimer &gt;=100){<br />&nbsp; &nbsp; myTimer = millis();<br />&nbsp; &nbsp; int x = map(RemoteXY.slider_01, -100, 100, 0, 180);<br />&nbsp; &nbsp; myservo.write(x);<br />&nbsp; }</p><br /><p>}</p><p>Можете сказать этот код далёк от того, что вы имели ввиду?&nbsp; Если да можете пожалуйста привести пример один из описсаных вами циклов.</p>]]></content>
			<author>
				<name><![CDATA[Айдар]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2797</uri>
			</author>
			<updated>2024-06-14T21:37:05Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5586#p5586</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: код для бесколлекторного моторчика]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5584#p5584" />
			<content type="html"><![CDATA[<p>Формулы про которые вы говорите - есть функция map которая за вас решит эту задачу. <a target="_blank" href="https://arduino.ru/Reference/Map">https://arduino.ru/Reference/Map</a><br />Что касается &quot;плавно поворачиваться&quot;, это немного сложнее. Если в кратко, то ваш микроконтроллер умеет производить вычисления как минимум несколько раз в секунду. Вы должны в каждом цикле получать текущее время, и далее вычислять нужное положение сервопривода для этого момента времени и отправлять это положение в серво. 10-20 раз в секунду думаю будет достаточно. Таким образом вы можете заставить ваш сервопривод вращаться настолько плавно на сколько захотите.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2024-06-14T07:52:50Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5584#p5584</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: код для бесколлекторного моторчика]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5580#p5580" />
			<content type="html"><![CDATA[<p>Вот код для бесколлектоного моторчика если кому надо:<br />#include &lt;Servo.h&gt;</p><p>/*<br />&nbsp; &nbsp;-- New project1 --<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;This source code of graphical user interface <br />&nbsp; &nbsp;has been generated automatically by RemoteXY editor.<br />&nbsp; &nbsp;To compile this code using RemoteXY library 3.1.13 or later version <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 4.13.13 or later version;<br />&nbsp; &nbsp; &nbsp;- for iOS 1.10.3 or later version;<br />&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; <br />*/</p><p>//////////////////////////////////////////////<br />//&nbsp; &nbsp; &nbsp; &nbsp; RemoteXY include library&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //<br />//////////////////////////////////////////////</p><p>// можете включить вывод отладочной информации в Serial на 115200<br />//#define REMOTEXY__DEBUGLOG&nbsp; &nbsp; </p><p>// определение режима соединения и подключение библиотеки RemoteXY <br />#define REMOTEXY_MODE__HARDSERIAL</p><br /><p>// настройки соединения <br />#define REMOTEXY_SERIAL Serial<br />#define REMOTEXY_SERIAL_SPEED 9600</p><br /><p>#include &lt;RemoteXY.h&gt;</p><p>// конфигурация интерфейса RemoteXY&nbsp; <br />#pragma pack(push, 1)&nbsp; <br />uint8_t RemoteXY_CONF[] =&nbsp; &nbsp;// 45 bytes<br />&nbsp; { 255,2,0,0,0,38,0,17,0,0,0,13,2,106,200,200,84,1,1,2,<br />&nbsp; 0,4,16,22,27,81,17,53,78,14,176,94,26,4,18,152,73,24,150,2,<br />&nbsp; 17,71,0,37,26 };<br />&nbsp; <br />// структура определяет все переменные и события вашего интерфейса управления <br />struct {</p><p>&nbsp; &nbsp; // input variables<br />&nbsp; int8_t slider_02; // oт 0 до 100</p><p>&nbsp; &nbsp; // other variable<br />&nbsp; uint8_t connect_flag;&nbsp; // =1 if wire connected, else =0</p><p>} RemoteXY;&nbsp; &nbsp;<br />#pragma pack(pop)</p><p>/////////////////////////////////////////////<br />//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;END RemoteXY include&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //<br />/////////////////////////////////////////////</p><p>Servo motor1;</p><p>void setup() <br />{<br />&nbsp; RemoteXY_Init (); </p><p>&nbsp; motor1.attach(2);<br />&nbsp; motor1.writeMicroseconds(2300);<br />&nbsp; delay(2000);<br />&nbsp; motor1.writeMicroseconds(800);<br />&nbsp; delay(6000);</p><p>}</p><p>void loop() <br />{ <br />&nbsp; RemoteXY_Handler ();</p><p>&nbsp; int val = map(RemoteXY.slider_02, 0, 100, 800, 2300);<br />&nbsp; motor1.writeMicroseconds(val);</p><p>}<br />Все воросы до этого исчерпаны. Но появиля новый, как заставить серво поварачиватся плавно?</p>]]></content>
			<author>
				<name><![CDATA[Айдар]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2797</uri>
			</author>
			<updated>2024-06-11T07:33:27Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5580#p5580</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[код для бесколлекторного моторчика]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5575#p5575" />
			<content type="html"><![CDATA[<p>Здравствуйте, создаю проект включающий серво и бесколлекторный мотрчик. Есть 3 вопроса.<br />1. Какую формулу для серво использовать со слайдером от -100 до 100?<br />2. Какую формулу использовать для бесколлекторного мотрчика со слайдером от 0 до 100?<br />3. Как вычесляется эта формула для сервы /int ms = RemoteXY.slider_1*20+500;/ из примера по подключению сервопривода</p>]]></content>
			<author>
				<name><![CDATA[Айдар]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2797</uri>
			</author>
			<updated>2024-06-08T19:16:20Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5575#p5575</id>
		</entry>
</feed>
