I have been working on a project that includes two servos, one is on X axis the other is Y, the Arduino takes my cursor's X,Y coordinates over a Visual C# program and translates them through the Arduino and to the two servos in order to effectively control both servo's via my mouse. The problem is that I want this to be a wireless connection from the PC to the Arduino, I've been having so many issues with it, the Arduino has a wireless signal and will connect to my PC, but once I connect the output port to the Arduino serial monitor, tera term, or any other program used in similar ways; the Arduino doesn't receive any output commands from the terminal.
Here's the source code without any bluetooth:
#include<Servo.h>
Servo serX;
Servo serY;
String serialData;
void setup() {
serX.attach(11);
serY.attach(10);
Serial.begin(9600);
Serial.setTimeout(10);
}
void loop() {
}
void serialEvent() {
serialData = Serial.readString();
serX.write(parseDataX(serialData));
serY.write(parseDataY(serialData));
}
int parseDataX(String data){
data.remove(data.indexOf("Y"));
data.remove(data.indexOf("X"), 1);
return data.toInt();
}
int parseDataY(String data){
data.remove(0,data.indexOf("Y") + 1);
return data.toInt();
}
I've tried so many different source codes to set up bluetooth, I'm not sure which one I should put on here. I feel like it could be something with the visual C# application, I don't know if it is properly communicating with the Arduino either.