<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — mesure et affichage distance  et commande servo moteur]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=961</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=961&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in mesure et affichage distance  et commande servo moteur.]]></description>
		<lastBuildDate>Thu, 09 Apr 2020 16:37:56 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: mesure et affichage distance  et commande servo moteur]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=2795#p2795</link>
			<description><![CDATA[<p>Je pense que ce serait mieux si distance était de type float au lieu de long, et si tu supprimais le delay</p>]]></description>
			<author><![CDATA[null@example.com (Guillaume)]]></author>
			<pubDate>Thu, 09 Apr 2020 16:37:56 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=2795#p2795</guid>
		</item>
		<item>
			<title><![CDATA[mesure et affichage distance  et commande servo moteur]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=2780#p2780</link>
			<description><![CDATA[<p>Ce mini projet mesure la distance et commande par un servo moteur l&#039;ouverture d&#039;une poubelle<br />code<br />#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT<br />#include &lt;ESP8266WiFi.h&gt;<br />#include &lt;Servo.h&gt;<br />#include &lt;RemoteXY.h&gt;</p><p>// RemoteXY connection settings <br />#define REMOTEXY_WIFI_SSID &quot;RemoteXY&quot;<br />#define REMOTEXY_WIFI_PASSWORD &quot;&quot;<br />#define REMOTEXY_SERVER_PORT 6377<br />Servo servo;</p><p>#define TRIGGER 5<br />#define ECHO&nbsp; &nbsp; 4</p><p>// NodeMCU Pin D1 &gt; TRIGGER | Pin D2 &gt; ECHO</p><p>// RemoteXY configurate&nbsp; <br />#pragma pack(push, 1)<br />uint8_t RemoteXY_CONF[] =<br />&nbsp; { 255,0,0,14,0,32,0,10,13,0,<br />&nbsp; 66,132,13,17,36,28,2,24,65,4,<br />&nbsp; 73,8,9,9,65,2,73,45,9,9,<br />&nbsp; 67,5,65,25,24,11,2,26,11 };<br />&nbsp; <br />// this structure defines all the variables and events of your control interface <br />struct {</p><p>&nbsp; &nbsp; // output variables<br />&nbsp; int8_t level_1; // =0..100 level position <br />&nbsp; uint8_t led_1_r; // =0..255 LED Red brightness <br />&nbsp; uint8_t led_2_g; // =0..255 LED Green brightness <br />&nbsp; char text_1[11];&nbsp; // string UTF8 end zero </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><br /><br /><p>void setup() <br />{<br />&nbsp; RemoteXY_Init (); <br />&nbsp; <br />&nbsp; <br />&nbsp; // TODO you setup code<br />&nbsp; &nbsp;Serial.begin (9600);<br />&nbsp; pinMode(TRIGGER, OUTPUT);<br />&nbsp; pinMode(ECHO, INPUT);<br />&nbsp; pinMode(BUILTIN_LED, OUTPUT);</p><p>&nbsp; servo.attach(2);&nbsp; //D4<br />&nbsp; servo.write(0);<br />&nbsp; delay(2000); <br />&nbsp; <br />}</p><p>void loop() <br />{ <br />&nbsp; RemoteXY_Handler ();<br />&nbsp; <br />&nbsp; long duration, distance;<br />&nbsp; digitalWrite(TRIGGER, LOW);&nbsp; <br />&nbsp; delayMicroseconds(2); <br />&nbsp; <br />&nbsp; digitalWrite(TRIGGER, HIGH);<br />&nbsp; delayMicroseconds(10); <br />&nbsp; <br />&nbsp; digitalWrite(TRIGGER, LOW);<br />&nbsp; duration = pulseIn(ECHO, HIGH);<br />&nbsp; distance = (duration/2) / 29.1;<br />&nbsp; <br />&nbsp; Serial.print(distance);<br />&nbsp; Serial.println(&quot;Centimeter:&quot;);<br />&nbsp; delay(1000);</p> <br /><p>&nbsp; <br />&nbsp; if (distance&lt;15)<br />&nbsp; {<br />&nbsp; &nbsp; &nbsp;RemoteXY.led_1_r = 255;&nbsp; &nbsp;// then turn on red light<br />&nbsp; &nbsp; &nbsp;RemoteXY.led_2_g = 0; <br />&nbsp; &nbsp; &nbsp;servo.write(90); <br />&nbsp; &nbsp; &nbsp;RemoteXY.level_1 =45; <br />&nbsp; &nbsp; &nbsp;dtostrf(distance, 0, 0, RemoteXY.text_1);<br />&nbsp; }<br />&nbsp; else<br />&nbsp; <br />&nbsp; {<br />&nbsp; &nbsp; RemoteXY.led_1_r = 0;&nbsp; &nbsp; &nbsp;// turn off red<br />&nbsp; &nbsp; RemoteXY.led_2_g = 255; <br />&nbsp; &nbsp; servo.write(0);<br />&nbsp; &nbsp; RemoteXY.level_1 = 0; <br />&nbsp; &nbsp; dtostrf(distance, 0, 0, RemoteXY.text_1);<br />&nbsp; &nbsp; <br />&nbsp; // TODO you loop code<br />&nbsp; // use the RemoteXY structure for data transfer</p><p>&nbsp; }</p>]]></description>
			<author><![CDATA[null@example.com (bil87777)]]></author>
			<pubDate>Mon, 06 Apr 2020 18:16:57 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=2780#p2780</guid>
		</item>
	</channel>
</rss>
