Using Text Box to sent string to Arduino Through Serial.read();

I have a problem at to sending a several text box to arduino. So i have a plan of making 4 text box which then will be sent to arduino in sentence in each text box, but look like in the Serial.read(); will read string word by word. So i do rightnow store the each alphabet into an string array. which then will be read through the Serial.print to print out the a sentence from each text box which seperated between text box 1, text box 2, text box 3. Please the Guidance, here's my files and sketch

Bluetooth_Font.aia (2.3 KB)

Please also upload your Arduino sketch, for one of our Arduino experts.

Owhh yeah my bad

#include <Adafruit_NeoPixel.h>

#define CLR_WHITE 8
#define CLR_RED 2


const int led_row =5;
const int led_col=24;
int led_count= led_row *led_col;

const int led_wave_reset=0;

Adafruit_NeoPixel strip = Adafruit_NeoPixel (led_count,2,NEO_GRB + NEO_KHZ800);
int i=0;
int h1=0;
char data;
byte numChar=0;
String myChar[40];
byte numChar1=0;
String myChar1[40];
byte numChar2=0;
String myChar2[40];
byte numChar3=0;
String myChar3[40];
byte z1=0;

int led_wave_index=led_wave_reset;
int led_wave_mode=0;
int led_wave_active=0;
int wave_index=0;
int go=0;

byte value_r=255;
byte value_g=0;
byte value_b=0;
byte color_in_row[12];
int index_animasi=0;

byte color_data[9][3]{
  {0,255,255},
  {255,255,0},
  {255,0,0},
  {0,255,0},
  {0,0,255},
  {0,255,255},
  {255,0,0},
  {0,0,255},
  {255,255,255}
};

const byte font_wave[] PROGMEM ={
        0x1C, 0x0A, 0x09, 0x0A, 0x1C, 0x00,      // Code for char A
        0x1F, 0x15, 0x15, 0x15, 0x0A, 0x00,      // Code for char B
        0x1F, 0x11, 0x11, 0x11, 0x11, 0x00,      // Code for char C
        0x1F, 0x11, 0x11, 0x11, 0x0E, 0x00,      // Code for char D
        0x1F, 0x15, 0x15, 0x15, 0x15, 0x00,      // Code for char E
        0x1F, 0x05, 0x05, 0x05, 0x05, 0x00,      // Code for char F
        0x1F, 0x11, 0x15, 0x15, 0x1D, 0x00,      // Code for char G
        0x1F, 0x04, 0x04, 0x04, 0x1F, 0x00,      // Code for char H
        0x11, 0x11, 0x1F, 0x11, 0x11, 0x00,      // Code for char I
        0x08, 0x10, 0x10, 0x10, 0x0F, 0x00,      // Code for char J
        0x1F, 0x04, 0x0E, 0x1B, 0x11, 0x00,      // Code for char K
        0x1F, 0x10, 0x10, 0x10, 0x10, 0x00,      // Code for char L
        0x1F, 0x02, 0x04, 0x02, 0x1F, 0x00,      // Code for char M
        0x1F, 0x02, 0x04, 0x08, 0x1F, 0x00,      // Code for char N
        0x0E, 0x11, 0x11, 0x11, 0x0E, 0x00,      // Code for char O
        0x1F, 0x05, 0x05, 0x05, 0x07, 0x00,       // Code for char P
        0x0E, 0x11, 0x15, 0x09, 0x16, 0x00,      // Code for char Q
        0x1F, 0x05, 0x0D, 0x15, 0x02, 0x00,      // Code for char R
        0x12, 0x15, 0x15, 0x15, 0x09, 0x00,      // Code for char S
        0x01, 0x01, 0x1F, 0x01, 0x01, 0x00,      // Code for char T
        0x0F, 0x10, 0x10, 0x10, 0x0F, 0x00,      // Code for char U
        0x07, 0x08, 0x10, 0x08, 0x07, 0x00,      // Code for char V
        0x1F, 0x08, 0x04, 0x08, 0x1F, 0x00,      // Code for char W
        0x11, 0x0A, 0x04, 0x0A, 0x11, 0x00,      // Code for char X
        0x01, 0x02, 0x1C, 0x02, 0x01, 0x00,      // Code for char Y
        0x11, 0x19, 0x15, 0x13, 0x11, 0x00      // Code for char Z
};

const byte module_max=10;
byte data_col[module_max*12];

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Belajar Strobo #Eps.02 ShareAnimasi 001");
  strip.begin();
  strip.show();
}

void loop() {
 if(Serial.available()){
  if(z1<10){
   myChar[numChar] = Serial.read();
   Serial.print(myChar[numChar]);
   if(numChar>39){
    numChar=0;
  }
  numChar++;
  }
  if(z1>10 || z1<=20){
    myChar1[numChar1] = Serial.read();
   Serial.print(myChar1[numChar1]);
   if(numChar1>39){
    numChar1=0;
  }
  numChar1++;
  }
  if(z1>20||z1<=30){
    myChar2[numChar2] = Serial.read();
   Serial.print(myChar2[numChar2]);
   if(numChar2>39){
    numChar2=0;
  }
  numChar2++;
  }
  if(z1>30||z1<=40){
    myChar3[numChar3] = Serial.read();
   Serial.print(myChar3[numChar3]);
   if(numChar3>39){
    numChar3=0;
  }
  numChar3++;
  }
  h1=1;
  z1++;
  }

  for(int c=0;c<40;c++){
    Serial.print(myChar[c]);
  }
  for(int c=0;c<40;c++){
    Serial.print(myChar1[c]);
  }
  for(int c=0;c<40;c++){
    Serial.print(myChar2[c]);
  }
  for(int c=0;c<40;c++){
    Serial.print(myChar3[c]);
  }
}

so what i want is to have 4 Strings of Array to which each of string array will read each of those Text Box, but the problem in the Serial.Read(); will read all together.

1 Like