Hello, I am very new to arduino
But i have an error:
bluetooth.ino: In function 'void readdata(const String&)':
bluetooth.ino:37:18: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
This is my script:
#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11);
String Data = "";
String str;
char character;
void setup() {
Serial.begin(9600);
BT.begin(9600);
pinMode(13, OUTPUT);
}
void loop() {
if (Serial.available() > 0){
str = Serial.readStringUntil('/n');
Serial.println(str);
BT.println(str);
}
if(BT.available()){
character = BT.read();
Data.concat(character);
if(character == '\n'){
digitalWrite(13, HIGH);
Serial.println(Data);
readdata(Data);
Data = "";
delay(10);
digitalWrite(13, LOW);
}
}
}
void readdata(const String& Datastr) {
if (Datastr == 'hoi'){
digitalWrite(13, HIGH);
delay(200);
digitalWrite(13, LOW);
}
}
I didn't had this error before adding the readdata void.
I have no idea what is wrong, can someone help me?