0

I am trying to send simple string values from my arduino to processing via bleutooth using the hc05 module. I already paired the hc05 with my computer and got its port name as shown in the image below:

enter image description here

but everytime I try to send data the hc05 starts blinking really slow and that's it.

here is the arduino code:

#include <SoftwareSerial.h>
int rx = 2;
int tx = 3;
SoftwareSerial blue(rx,tx);
void setup() {
blue.begin(38400);
}

void loop() {
blue.println("10");
delay(100);
}

here is the processing code:

import processing.serial.*;

Serial myPort;  

void setup () {
size(400, 300);
myPort = new Serial(this, "COM8", 38400);
myPort.bufferUntil('\n');
background(0);
}

void draw () {
}

void serialEvent (Serial myPort) {
String inString = myPort.readStringUntil('\n');
if (inString != null) {
  // trim off any whitespace:
  inString = trim(inString);
  println(inString);
}
}

also: the rx pin of the hc05 is connected to pin 2 of arduino

the tx pin of the hc05 is connected to pin 3 of arduino

the gnd pin of the hc05 is connected to gnd pin of arduino

the vcc pin of the hc05 is connected to 3.3 pin of arduino

  • 2
    Sounds like you might have rx and tx backwards. When you whisper to someone, do you put your ear to their ear (rx to rx) or do you put your mouth close to their ear (tx to rx). – Delta_G Jul 2 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.