Hello there !
I am currently working on a system that needs to recieve a variable from our smartphone app created on App Inventor, to the Arduino card. I'm currently able to get the value of it and print it on the serial monitor, but I'm having a little problem : if I send for example a value of 38, the LCD is displaying this : "16 51 56".
I don't really know what I have to change to make it working, so I'm asking to you some help !
Here is my Arduino code :
#include <Wire.h>
#include <rgb_lcd.h>
#include <SoftwareSerial.h>
#define MASTER 0
int test = 62;
const int RGB_Red = 81;
const int RGB_Green = 168;
const int RGB_Blue = 255;
SoftwareSerial BTserial(6, 7); // RX | TX
rgb_lcd lcd;
int valeur_var;
String mot;
void setup()
{
lcd.begin(16, 2);
lcd.setRGB(RGB_Red, RGB_Green, RGB_Blue);
lcd.setCursor(0, 0);
lcd.print("Ready...");
delay(2000);
lcd.clear();
Serial.begin(9600);
Serial.println("Arduino is ready");
BTserial.begin(9600);
BTserial.flush();
BTserial.write("Ready\n");
}
void loop() {
#if MASTER
BTserial.write(45);
int bytesSent = BTserial.print(test);
delay(800);
#else
if (BTserial.available())
{
valeur_var = BTserial.read();
Serial.write(valeur_var);
lcd.setCursor(0, 0);
lcd.print(valeur_var);
delay(400);
}
if (Serial.available())
{
valeur_var = Serial.read();
BTserial.write(valeur_var);
}
#endif
}
If you have any idea, or example of code that could help me, pls share it to me
Thanks for taking a look to my topic !
Have a nice day