How to remove sent data delay from 433hz wireless transmitter and reciever arduinoEcho the data that is sent by Linux to ArduinoHow to use delays in Arduino code?how to interrupt arduino when data recieved via rx pinrecieving of data on android from arduino via bluetoothRecieving Data From Arduino in Winformhow to remove the delay in obtaining data from the Arduino via COM?My Qt app does not recieve all the data sent by arduinoRGB data sent from python program not recieving right by arduinoReading char sent from wireless transmitter and creating switch case
Why can't I see bouncing of switch on oscilloscope screen?
Paid for article while in US on F-1 visa?
What typically incentivizes a professor to change jobs to a lower ranking university?
Replacing matching entries in one column of a file by another column from a different file
Watching something be written to a file live with tail
Can a Cauchy sequence converge for one metric while not converging for another?
I'm flying to France today and my passport expires in less than 2 months
meaning of に in 本当に?
Does object always see its latest internal state irrespective of thread?
Uncaught TypeError: 'set' on proxy: trap returned falsish for property Name
Languages that we cannot (dis)prove to be Context-Free
dbcc cleantable batch size explanation
How much RAM could one put in a typical 80386 setup?
Are astronomers waiting to see something in an image from a gravitational lens that they've already seen in an adjacent image?
Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)
Do infinite dimensional systems make sense?
Why doesn't H₄O²⁺ exist?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Has there ever been an airliner design involving reducing generator load by installing solar panels?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
Horror movie about a virus at the prom; beginning and end are stylized as a cartoon
Roll the carpet
What does it mean to describe someone as a butt steak?
What would happen to a modern skyscraper if it rains micro blackholes?
How to remove sent data delay from 433hz wireless transmitter and reciever arduino
Echo the data that is sent by Linux to ArduinoHow to use delays in Arduino code?how to interrupt arduino when data recieved via rx pinrecieving of data on android from arduino via bluetoothRecieving Data From Arduino in Winformhow to remove the delay in obtaining data from the Arduino via COM?My Qt app does not recieve all the data sent by arduinoRGB data sent from python program not recieving right by arduinoReading char sent from wireless transmitter and creating switch case
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to make a remote controller that controls a car that I built. It works but whenever I turn the joystick on the controller, there is a 1 - 5 second delay between my turning the joystick and the car turning. PLease help remove the delay.
I am using two arduino mega 2560's (one for the controller and one for the car.
433hz wireless transmitter + receiver.
micro servo
TRANSMITTER CODE
#include <Servo.h>
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
#define GROUND_JOY_PIN A3
#define VOUT_JOY_PIN A2
#define XJOY_PIN A1
#define YJOY_PIN A0
Servo myservo;
RH_ASK rf_driver;
String str_joyX;
String str_joyY;
String xy;
int joyX1;
int joyY1;
int joyX;
int joyY;
void setup()
Serial.begin(9600);
pinMode(VOUT_JOY_PIN, OUTPUT) ; //pin A3 shall be used as output
pinMode(GROUND_JOY_PIN, OUTPUT) ; //pin A2 shall be used as output
digitalWrite(VOUT_JOY_PIN, HIGH) ; //set pin A3 to high (+5V)
digitalWrite(GROUND_JOY_PIN,LOW) ; //set pin A3 to low (ground)
myservo.attach(22);
// Initialize ASK Object
rf_driver.init();
void loop()
joyY1 = analogRead(YJOY_PIN);
joyX1 = analogRead(XJOY_PIN);
joyY = ((joyY1+520)/25);
joyX = ((joyX1+520)/25);
//Serial.println("Joy X:");
//Serial.println(joyX);
//Serial.println("Joy Y:");
//Serial.println(joyY);
//Serial.println("");
str_joyX = String(joyX);
str_joyY = String(joyY);
xy = str_joyX + "," + str_joyY;
char *msg = xy.c_str();
rf_driver.send((uint8_t *)msg, strlen(msg));
rf_driver.waitPacketSent();
delay(10);
RECEIVER CODE
#include <Servo.h>
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
#define SERVO_PIN 22
//X axis reading from joystick will go into analog pin A1
Servo myservo;
String str_joyX;
String str_joyY;
String xy;
int joyX;
int joyY;
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
// Initialize ASK Object
rf_driver.init();
Serial.begin(9600);
myservo.attach(22);
void loop()
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
// Check if received packet is correct size
if (rf_driver.recv(buf, &buflen))
xy = String((char*)buf);
for (int i = 0; i < xy.length(); i++)
if (xy.substring(i, i+1) == ",")
str_joyX = xy.substring(0, i);
str_joyY = xy.substring(i+1);
joyX = str_joyX.toInt();
joyY = str_joyY.toInt();
//Serial.println("Joy X:");
//Serial.println(joyX);
//Serial.println("Joy Y:");
//Serial.println(joyY);
//Serial.println("");
myservo.write(joyX);
delay(10);
c arduino
|
show 16 more comments
I am trying to make a remote controller that controls a car that I built. It works but whenever I turn the joystick on the controller, there is a 1 - 5 second delay between my turning the joystick and the car turning. PLease help remove the delay.
I am using two arduino mega 2560's (one for the controller and one for the car.
433hz wireless transmitter + receiver.
micro servo
TRANSMITTER CODE
#include <Servo.h>
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
#define GROUND_JOY_PIN A3
#define VOUT_JOY_PIN A2
#define XJOY_PIN A1
#define YJOY_PIN A0
Servo myservo;
RH_ASK rf_driver;
String str_joyX;
String str_joyY;
String xy;
int joyX1;
int joyY1;
int joyX;
int joyY;
void setup()
Serial.begin(9600);
pinMode(VOUT_JOY_PIN, OUTPUT) ; //pin A3 shall be used as output
pinMode(GROUND_JOY_PIN, OUTPUT) ; //pin A2 shall be used as output
digitalWrite(VOUT_JOY_PIN, HIGH) ; //set pin A3 to high (+5V)
digitalWrite(GROUND_JOY_PIN,LOW) ; //set pin A3 to low (ground)
myservo.attach(22);
// Initialize ASK Object
rf_driver.init();
void loop()
joyY1 = analogRead(YJOY_PIN);
joyX1 = analogRead(XJOY_PIN);
joyY = ((joyY1+520)/25);
joyX = ((joyX1+520)/25);
//Serial.println("Joy X:");
//Serial.println(joyX);
//Serial.println("Joy Y:");
//Serial.println(joyY);
//Serial.println("");
str_joyX = String(joyX);
str_joyY = String(joyY);
xy = str_joyX + "," + str_joyY;
char *msg = xy.c_str();
rf_driver.send((uint8_t *)msg, strlen(msg));
rf_driver.waitPacketSent();
delay(10);
RECEIVER CODE
#include <Servo.h>
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
#define SERVO_PIN 22
//X axis reading from joystick will go into analog pin A1
Servo myservo;
String str_joyX;
String str_joyY;
String xy;
int joyX;
int joyY;
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
// Initialize ASK Object
rf_driver.init();
Serial.begin(9600);
myservo.attach(22);
void loop()
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
// Check if received packet is correct size
if (rf_driver.recv(buf, &buflen))
xy = String((char*)buf);
for (int i = 0; i < xy.length(); i++)
if (xy.substring(i, i+1) == ",")
str_joyX = xy.substring(0, i);
str_joyY = xy.substring(i+1);
joyX = str_joyX.toInt();
joyY = str_joyY.toInt();
//Serial.println("Joy X:");
//Serial.println(joyX);
//Serial.println("Joy Y:");
//Serial.println(joyY);
//Serial.println("");
myservo.write(joyX);
delay(10);
c arduino
@elgonzo thought arduino was in c, c#. Sorry, I fixed it.
– Neo630
Mar 21 at 22:53
What are those shenanigans there in your receiver code using a for loop and substring just to find a comma in a string? There should be a simpler way to do this, something like (pseudo-code!)commaPosition = xy.FindChar(',')
, or something similar. Look up and spend some time with the documentation for the String class to see what method(s) it provides to find a character (or string) within a string...
– elgonzo
Mar 21 at 22:54
@elgonzo Does using the for loop add a delay?
– Neo630
Mar 21 at 22:55
I leave that to you to figure out how much time your for-loop & substring(i, i+1) dance costs in comparison to using a simple string method call to find the position of the comma in the string. (I don't use an Ardunio, so i can't tell how expensive that for-loop & substring stuff you are doing really is...)
– elgonzo
Mar 21 at 22:57
@elgonzo I do believe substring is the only way to achieve this goal.
– Neo630
Mar 21 at 23:12
|
show 16 more comments
I am trying to make a remote controller that controls a car that I built. It works but whenever I turn the joystick on the controller, there is a 1 - 5 second delay between my turning the joystick and the car turning. PLease help remove the delay.
I am using two arduino mega 2560's (one for the controller and one for the car.
433hz wireless transmitter + receiver.
micro servo
TRANSMITTER CODE
#include <Servo.h>
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
#define GROUND_JOY_PIN A3
#define VOUT_JOY_PIN A2
#define XJOY_PIN A1
#define YJOY_PIN A0
Servo myservo;
RH_ASK rf_driver;
String str_joyX;
String str_joyY;
String xy;
int joyX1;
int joyY1;
int joyX;
int joyY;
void setup()
Serial.begin(9600);
pinMode(VOUT_JOY_PIN, OUTPUT) ; //pin A3 shall be used as output
pinMode(GROUND_JOY_PIN, OUTPUT) ; //pin A2 shall be used as output
digitalWrite(VOUT_JOY_PIN, HIGH) ; //set pin A3 to high (+5V)
digitalWrite(GROUND_JOY_PIN,LOW) ; //set pin A3 to low (ground)
myservo.attach(22);
// Initialize ASK Object
rf_driver.init();
void loop()
joyY1 = analogRead(YJOY_PIN);
joyX1 = analogRead(XJOY_PIN);
joyY = ((joyY1+520)/25);
joyX = ((joyX1+520)/25);
//Serial.println("Joy X:");
//Serial.println(joyX);
//Serial.println("Joy Y:");
//Serial.println(joyY);
//Serial.println("");
str_joyX = String(joyX);
str_joyY = String(joyY);
xy = str_joyX + "," + str_joyY;
char *msg = xy.c_str();
rf_driver.send((uint8_t *)msg, strlen(msg));
rf_driver.waitPacketSent();
delay(10);
RECEIVER CODE
#include <Servo.h>
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
#define SERVO_PIN 22
//X axis reading from joystick will go into analog pin A1
Servo myservo;
String str_joyX;
String str_joyY;
String xy;
int joyX;
int joyY;
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
// Initialize ASK Object
rf_driver.init();
Serial.begin(9600);
myservo.attach(22);
void loop()
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
// Check if received packet is correct size
if (rf_driver.recv(buf, &buflen))
xy = String((char*)buf);
for (int i = 0; i < xy.length(); i++)
if (xy.substring(i, i+1) == ",")
str_joyX = xy.substring(0, i);
str_joyY = xy.substring(i+1);
joyX = str_joyX.toInt();
joyY = str_joyY.toInt();
//Serial.println("Joy X:");
//Serial.println(joyX);
//Serial.println("Joy Y:");
//Serial.println(joyY);
//Serial.println("");
myservo.write(joyX);
delay(10);
c arduino
I am trying to make a remote controller that controls a car that I built. It works but whenever I turn the joystick on the controller, there is a 1 - 5 second delay between my turning the joystick and the car turning. PLease help remove the delay.
I am using two arduino mega 2560's (one for the controller and one for the car.
433hz wireless transmitter + receiver.
micro servo
TRANSMITTER CODE
#include <Servo.h>
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
#define GROUND_JOY_PIN A3
#define VOUT_JOY_PIN A2
#define XJOY_PIN A1
#define YJOY_PIN A0
Servo myservo;
RH_ASK rf_driver;
String str_joyX;
String str_joyY;
String xy;
int joyX1;
int joyY1;
int joyX;
int joyY;
void setup()
Serial.begin(9600);
pinMode(VOUT_JOY_PIN, OUTPUT) ; //pin A3 shall be used as output
pinMode(GROUND_JOY_PIN, OUTPUT) ; //pin A2 shall be used as output
digitalWrite(VOUT_JOY_PIN, HIGH) ; //set pin A3 to high (+5V)
digitalWrite(GROUND_JOY_PIN,LOW) ; //set pin A3 to low (ground)
myservo.attach(22);
// Initialize ASK Object
rf_driver.init();
void loop()
joyY1 = analogRead(YJOY_PIN);
joyX1 = analogRead(XJOY_PIN);
joyY = ((joyY1+520)/25);
joyX = ((joyX1+520)/25);
//Serial.println("Joy X:");
//Serial.println(joyX);
//Serial.println("Joy Y:");
//Serial.println(joyY);
//Serial.println("");
str_joyX = String(joyX);
str_joyY = String(joyY);
xy = str_joyX + "," + str_joyY;
char *msg = xy.c_str();
rf_driver.send((uint8_t *)msg, strlen(msg));
rf_driver.waitPacketSent();
delay(10);
RECEIVER CODE
#include <Servo.h>
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
#define SERVO_PIN 22
//X axis reading from joystick will go into analog pin A1
Servo myservo;
String str_joyX;
String str_joyY;
String xy;
int joyX;
int joyY;
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
// Initialize ASK Object
rf_driver.init();
Serial.begin(9600);
myservo.attach(22);
void loop()
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
// Check if received packet is correct size
if (rf_driver.recv(buf, &buflen))
xy = String((char*)buf);
for (int i = 0; i < xy.length(); i++)
if (xy.substring(i, i+1) == ",")
str_joyX = xy.substring(0, i);
str_joyY = xy.substring(i+1);
joyX = str_joyX.toInt();
joyY = str_joyY.toInt();
//Serial.println("Joy X:");
//Serial.println(joyX);
//Serial.println("Joy Y:");
//Serial.println(joyY);
//Serial.println("");
myservo.write(joyX);
delay(10);
c arduino
c arduino
edited Mar 21 at 22:53
Neo630
asked Mar 21 at 22:48
Neo630Neo630
45
45
@elgonzo thought arduino was in c, c#. Sorry, I fixed it.
– Neo630
Mar 21 at 22:53
What are those shenanigans there in your receiver code using a for loop and substring just to find a comma in a string? There should be a simpler way to do this, something like (pseudo-code!)commaPosition = xy.FindChar(',')
, or something similar. Look up and spend some time with the documentation for the String class to see what method(s) it provides to find a character (or string) within a string...
– elgonzo
Mar 21 at 22:54
@elgonzo Does using the for loop add a delay?
– Neo630
Mar 21 at 22:55
I leave that to you to figure out how much time your for-loop & substring(i, i+1) dance costs in comparison to using a simple string method call to find the position of the comma in the string. (I don't use an Ardunio, so i can't tell how expensive that for-loop & substring stuff you are doing really is...)
– elgonzo
Mar 21 at 22:57
@elgonzo I do believe substring is the only way to achieve this goal.
– Neo630
Mar 21 at 23:12
|
show 16 more comments
@elgonzo thought arduino was in c, c#. Sorry, I fixed it.
– Neo630
Mar 21 at 22:53
What are those shenanigans there in your receiver code using a for loop and substring just to find a comma in a string? There should be a simpler way to do this, something like (pseudo-code!)commaPosition = xy.FindChar(',')
, or something similar. Look up and spend some time with the documentation for the String class to see what method(s) it provides to find a character (or string) within a string...
– elgonzo
Mar 21 at 22:54
@elgonzo Does using the for loop add a delay?
– Neo630
Mar 21 at 22:55
I leave that to you to figure out how much time your for-loop & substring(i, i+1) dance costs in comparison to using a simple string method call to find the position of the comma in the string. (I don't use an Ardunio, so i can't tell how expensive that for-loop & substring stuff you are doing really is...)
– elgonzo
Mar 21 at 22:57
@elgonzo I do believe substring is the only way to achieve this goal.
– Neo630
Mar 21 at 23:12
@elgonzo thought arduino was in c, c#. Sorry, I fixed it.
– Neo630
Mar 21 at 22:53
@elgonzo thought arduino was in c, c#. Sorry, I fixed it.
– Neo630
Mar 21 at 22:53
What are those shenanigans there in your receiver code using a for loop and substring just to find a comma in a string? There should be a simpler way to do this, something like (pseudo-code!)
commaPosition = xy.FindChar(',')
, or something similar. Look up and spend some time with the documentation for the String class to see what method(s) it provides to find a character (or string) within a string...– elgonzo
Mar 21 at 22:54
What are those shenanigans there in your receiver code using a for loop and substring just to find a comma in a string? There should be a simpler way to do this, something like (pseudo-code!)
commaPosition = xy.FindChar(',')
, or something similar. Look up and spend some time with the documentation for the String class to see what method(s) it provides to find a character (or string) within a string...– elgonzo
Mar 21 at 22:54
@elgonzo Does using the for loop add a delay?
– Neo630
Mar 21 at 22:55
@elgonzo Does using the for loop add a delay?
– Neo630
Mar 21 at 22:55
I leave that to you to figure out how much time your for-loop & substring(i, i+1) dance costs in comparison to using a simple string method call to find the position of the comma in the string. (I don't use an Ardunio, so i can't tell how expensive that for-loop & substring stuff you are doing really is...)
– elgonzo
Mar 21 at 22:57
I leave that to you to figure out how much time your for-loop & substring(i, i+1) dance costs in comparison to using a simple string method call to find the position of the comma in the string. (I don't use an Ardunio, so i can't tell how expensive that for-loop & substring stuff you are doing really is...)
– elgonzo
Mar 21 at 22:57
@elgonzo I do believe substring is the only way to achieve this goal.
– Neo630
Mar 21 at 23:12
@elgonzo I do believe substring is the only way to achieve this goal.
– Neo630
Mar 21 at 23:12
|
show 16 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290374%2fhow-to-remove-sent-data-delay-from-433hz-wireless-transmitter-and-reciever-ardui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290374%2fhow-to-remove-sent-data-delay-from-433hz-wireless-transmitter-and-reciever-ardui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@elgonzo thought arduino was in c, c#. Sorry, I fixed it.
– Neo630
Mar 21 at 22:53
What are those shenanigans there in your receiver code using a for loop and substring just to find a comma in a string? There should be a simpler way to do this, something like (pseudo-code!)
commaPosition = xy.FindChar(',')
, or something similar. Look up and spend some time with the documentation for the String class to see what method(s) it provides to find a character (or string) within a string...– elgonzo
Mar 21 at 22:54
@elgonzo Does using the for loop add a delay?
– Neo630
Mar 21 at 22:55
I leave that to you to figure out how much time your for-loop & substring(i, i+1) dance costs in comparison to using a simple string method call to find the position of the comma in the string. (I don't use an Ardunio, so i can't tell how expensive that for-loop & substring stuff you are doing really is...)
– elgonzo
Mar 21 at 22:57
@elgonzo I do believe substring is the only way to achieve this goal.
– Neo630
Mar 21 at 23:12