problem with SoftwareSerial

hello,

I am trying to a byte from arduino via HC-06 bluetooth module to my android phone.
bytes 0 to 127 work fine, i can read the corresponding ASCII value on my phone.
bytes 128 to 255 are not transmitted (or not received).
on the android side i used the app BlueTerm

is my arduino code correct ?

does SoftwareSerial only send 7bits ?

is the problem on the android side ?

thx in advance,
wowi

#include <SoftwareSerial.h>

SoftwareSerial BT(10, 11); // <-----this here defines TX/Rx ports---

uint8_t dat = 0; //single byte read
int i = 0;
int strStream[5] = {65, 97, 164, 178, 255};

void setup() {
    BT.begin(9600); // writing to HC-06 on D10(D11)
}

void loop() {
  while (i < 5) {
    dat = getNextByte(i);
    delay(500);
    BT.write(dat);
    i++;
  }
  i = 0;
}

uint8_t getNextByte(int i) {
  dat = strStream[i];
  return dat;
}

SoftwareSerial should send all 8 bits.

...R

uint8_t getNextByte(int i) {
  dat = strStream[i];
  return dat;
}

You assigned a 16 bit, signed value to an unsigned 8 bit variable, and expected the assignment to work perfectly. Time for a reality check.

Thanks Paul for catching that!

After hours of wasting energy looking in the wrong corners and even suspecting SoftwareSerial, I found that my incorrect bit masking on the Android side was actually the problem.

regards,
w