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:


Servo serX;
Servo serY;

String serialData;

void setup() {


void loop() {

void serialEvent() {
  serialData = Serial.readString();

int parseDataX(String data){
  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.

  • 1. Does the program you added to the question, work well? I mean, does it works without bluetooth? If yes C# wouldn't be the problem. 2. What Bluetoth device do you use with the Arduino and what with the PC? Show us at least one code where you attempt to use bluetoth. And what are the error coming up with that code? How can we help, when you say "I've tried so many ways, but none of them worked"? We have no glue what happend. 3. The method String::remove() needs a count at the second argument; not a position. I don't think this code works at all. Commented Jan 28, 2021 at 14:55
  • The program I added does work pretty well, it could be faster but it works without bluetooth. I used a basic HC-05 bluetooth module, I don't have any of the full source codes where I tried bluetooth with this code saved. I tried to simply get my computer to light up an LED through bluetooth with 0 and 1 console commands and that didn't work either, I just need help with setting it up so that my PC can communicate with my Arduino, I'm okay with using something other than bluetooth if thats possible, I don't know what I should do in this kind of situation. Also the code works in practice so idk.
    – 4ourHearts
    Commented Jan 28, 2021 at 15:16
  • If your PC supports bluetooth, and the distance of the PC and the arduino wouldn't be more than - let's say - 3 meters, then bluetooth is a viable solution. This forum is not meant to provide a solution for you. You have to try youself, or search the internet for solutions. If you have tried something and there are errors, then post here what you've done, what you expect from it and what is not working. Then we could help. This is not a programming service. Tip: If the serial connection is too slow, it might help if you use a higher baud rate (115200) should work. Commented Jan 28, 2021 at 15:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.