<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — Using BTS7960 driver module with gyro but it doesn't move in -x ofgyro]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1753&amp;type=atom" />
	<updated>2024-02-20T06:50:21Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=1753</id>
		<entry>
			<title type="html"><![CDATA[Re: Using BTS7960 driver module with gyro but it doesn't move in -x ofgyro]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5360#p5360" />
			<content type="html"><![CDATA[<p>I tried to change the 2 and 7 pins to PWM pins and i works thank you.</p>]]></content>
			<author>
				<name><![CDATA[Vin1]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2682</uri>
			</author>
			<updated>2024-02-20T06:50:21Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5360#p5360</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Using BTS7960 driver module with gyro but it doesn't move in -x ofgyro]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5352#p5352" />
			<content type="html"><![CDATA[<p>Maybe pins 2 and 7 do not support PWM ?</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2024-02-19T04:39:34Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5352#p5352</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Using BTS7960 driver module with gyro but it doesn't move in -x ofgyro]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=5351#p5351" />
			<content type="html"><![CDATA[<p>#include &lt;dht.h&gt;<br />dht DHT;<br />int dhtSensorPin = 12;<br />int temperature;<br />int humidity;<br />//////////////////////////////////////////////<br />//&nbsp; &nbsp; &nbsp; &nbsp; RemoteXY include library&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //<br />//////////////////////////////////////////////</p><p>// RemoteXY select connection mode and include library <br />#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT</p><p>#include &lt;RemoteXY.h&gt;</p><p>// RemoteXY connection settings <br />#define REMOTEXY_SERIAL Serial<br />#define REMOTEXY_SERIAL_SPEED 115200<br />#define REMOTEXY_WIFI_SSID &quot;&quot;<br />#define REMOTEXY_WIFI_PASSWORD &quot;&quot;<br />#define REMOTEXY_SERVER_PORT 6377</p><br /><p>// RemoteXY configurate&nbsp; <br />#pragma pack(push, 1)<br />uint8_t RemoteXY_CONF[] =&nbsp; &nbsp;// 45 bytes<br />&nbsp; { 255,3,0,22,0,38,0,16,137,1,5,16,18,55,30,30,30,190,64,4,<br />&nbsp; 64,28,16,8,30,2,8,67,5,4,29,20,5,3,26,11,67,5,39,29,<br />&nbsp; 20,5,5,26,11 };<br />&nbsp; <br />// this structure defines all the variables and events of your control interface <br />struct {</p><p>&nbsp; &nbsp; // input variables<br />&nbsp; int8_t joystick_1_x; // from -100 to 100&nbsp; <br />&nbsp; int8_t joystick_1_y; // from -100 to 100&nbsp; <br />&nbsp; int8_t slider_1; // =0..100 slider position </p><p>&nbsp; &nbsp; // output variables<br />&nbsp; char text_temp[11];&nbsp; // string UTF8 end zero <br />&nbsp; char text_hum[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)<br />// Left motor<br />const uint8_t LEFT_R_PWM_PIN = 6;<br />const uint8_t LEFT_L_PWM_PIN = 7;<br />const uint8_t LEFT_R_EN_PIN = 4;<br />const uint8_t LEFT_L_EN_PIN = 5;</p><p>// Right motor<br />const uint8_t RIGHT_R_PWM_PIN = 2;<br />const uint8_t RIGHT_L_PWM_PIN = 3;<br />const uint8_t RIGHT_R_EN_PIN = 8;<br />const uint8_t RIGHT_L_EN_PIN = 9;<br />#include &lt;BTS7960.h&gt;<br />// Control motor<br /> BTS7960 motorController_1(RIGHT_R_EN_PIN, RIGHT_L_EN_PIN, RIGHT_R_PWM_PIN, RIGHT_L_PWM_PIN);<br /> BTS7960 motorController_2 (LEFT_R_EN_PIN, LEFT_L_EN_PIN, LEFT_R_PWM_PIN, LEFT_L_PWM_PIN );<br />void Wheel(int joystickX, int joystickY) {<br />&nbsp; int speedRight = map(joystickX, -100, 100, -255, 255); // Map joystick X-axis to right motor speed range<br />&nbsp; int speedLeft = map(joystickY, -100, 100, -255, 255); // Map joystick Y-axis to left motor speed range</p><p>&nbsp; if (speedRight &gt; 0) {<br />&nbsp; &nbsp; motorController_1.pwm = speedRight;<br />&nbsp; &nbsp; motorController_1.front();<br />&nbsp; } else if (speedRight &lt; 0) {<br />&nbsp; &nbsp; motorController_1.pwm = -speedRight;<br />&nbsp; &nbsp; motorController_1.back();<br />&nbsp; } else {<br />&nbsp; &nbsp; motorController_1.stop();<br />&nbsp; }</p><p>&nbsp; if (speedLeft &gt; 0) {<br />&nbsp; &nbsp; motorController_2.pwm = speedLeft;<br />&nbsp; &nbsp; motorController_2.front();<br />&nbsp; } else if (speedLeft &lt; 0) {<br />&nbsp; &nbsp; motorController_2.pwm = -speedLeft;<br />&nbsp; &nbsp; motorController_2.back();<br />&nbsp; } else {<br />&nbsp; &nbsp; motorController_2.stop();<br />&nbsp; }<br />}<br />void setup() {<br />&nbsp; RemoteXY_Init();<br />Serial.begin(115200);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//begin the serial monitor for output<br />&nbsp; motorController_1.begin();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//This method will set the motor driver pins as output<br />&nbsp; motorController_1.enable(); <br />&nbsp; motorController_2.begin();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//This method will set the motor driver pins as output<br />&nbsp; motorController_2.enable(); <br />&nbsp; /*<br />&nbsp; // Initialization pins for left motor<br />&nbsp; pinMode(LEFT_R_PWM_PIN, OUTPUT);<br />&nbsp; pinMode(LEFT_L_PWM_PIN, OUTPUT);<br />&nbsp; pinMode(LEFT_R_EN_PIN, OUTPUT);<br />&nbsp; pinMode(LEFT_L_EN_PIN, OUTPUT);</p><p>&nbsp; // Initialization pins for right motor<br />&nbsp; pinMode(RIGHT_R_PWM_PIN, OUTPUT);<br />&nbsp; pinMode(RIGHT_L_PWM_PIN, OUTPUT);<br />&nbsp; pinMode(RIGHT_R_EN_PIN, OUTPUT);<br />&nbsp; pinMode(RIGHT_L_EN_PIN, OUTPUT);<br />&nbsp; */<br />}<br />void loop() {<br /> RemoteXY_Handler();</p><p> /*<br />&nbsp; Wheel(RemoteXY.joystick_1_x, RemoteXY.joystick_1_y);<br /> */<br />&nbsp; int dhtCheck = DHT.read11(dhtSensorPin);<br />&nbsp; temperature = DHT.temperature;<br />&nbsp; humidity = DHT.humidity;</p><p>&nbsp; dtostrf(temperature, 0, 1, RemoteXY.text_temp);<br />&nbsp; dtostrf(humidity, 0, 1, RemoteXY.text_hum);</p><p>&nbsp; // Manage the motors<br /> Wheel(RemoteXY.joystick_1_x, RemoteXY.joystick_1_y);<br />}</p>]]></content>
			<author>
				<name><![CDATA[Vin1]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2682</uri>
			</author>
			<updated>2024-02-19T00:35:32Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=5351#p5351</id>
		</entry>
</feed>
