Hi,
I want to write and read single bytes with this BLE-modules.
The "void read" is ok, the "void write" not. What am I doing wrong?
Do I need to add in addition to "Serial2.print (7)" something?
Here is my code:
I want to write and read single bytes with this BLE-modules.
The "void read" is ok, the "void write" not. What am I doing wrong?
Do I need to add in addition to "Serial2.print (7)" something?
Here is my code:
Code:
void write() {
if (button0.fallingEdge()) {
Serial2.print(7);
}
if (button1.fallingEdge()) {
Serial2.print(6);
}
}
void read() {
if (Serial2.available()) {
int c = Serial2.read();
if( c == 1 ) // if 'H' was received
{
digitalWrite(ledpin, HIGH); // turn ON the LED
millisec = 0;
}
}
}