Arduino Due and ZS-040 bluetooth module

hello I'm trying to connect ZS 040 bluetooth module with my arduino due, vcc pin is connected to 3.3v and gnd to gnd of arduino now rx and tx pins are connected to tx1 and rx1 of due. I'm using the following code

void setup() {

 Serial.begin(9600);

pinMode(13, OUTPUT);

}

void loop() {

  if(Serial.available() > 0){

  char inByte = Serial.read();

  switch (inByte) {

case '0':

  digitalWrite(13, HIGH);   

  break;

  case '1':

  digitalWrite(13, LOW);   

  delay(1000);              // wait for a second

}}}

the same code is working fine with arduino uno and bluetooth module.

5v power source?
I agree with 6677, either change the code to use Serial1, or rewire to use Tx0 and Rx0. I’d change the code because it’s easier.

What voltage did you hook this module up with on the Uno?

The module’s description says it has a 3.3v LDO, so it might need a higher voltage than 3.3v. If the module worked with a Vcc of 5v before, it might be that.

Arduino Due uses 3.3v

Arduino Due uses 3.3v digital pins, you may want to use a “3v3 to 5v serial converter”.