coding error of code downloaded from net for diy project

hi i am completely new to arduino and its programming had seen a diy project and being impressed purchased all the goods (which has costed me) and now when i am uploading the code it is showing error please someone guide me as to what has to be done or how do i make the script so that i cannot upload without errors
please help
the code is
#include <SoftwareSerial.h>
#include "Arduino.h"
#include <Wire.h>//Include libraries: SoftwareSerial & Wire
SoftwareSerial ESP_BT(0,1); //Define PIN11 & PIN12 as RX and TX pins

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>

#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif

#define PIN 5

// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
// NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
// Position of the FIRST LED in the matrix; pick two, e.g.
// NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
// NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
// rows or in vertical columns, respectively; pick one or the other.
// NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
// in the same order, or alternate lines reverse direction; pick one.
// See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_GRBW Pixels are wired for GRBW bitstream (RGB+W NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

// Example for NeoPixel Shield. In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino. When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order. The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(
32, //Select LEDs of each row (15 in my case)
8, //Select amount of rows (7 in my case)
PIN,
NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT + //Define first data pin (right bottom corner is my first pin)
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, //Define the type of connection (in a zig zag connections and divided by rows not columns)
NEO_RGB + NEO_KHZ800);

int Red=255,Green=0,Blue=0;
String text="Easy Tech";
String RGB;
int pixelPerChar = 5,RGB_Completed=0;
int Delay, Brightness;
const uint16_t colors[] = {matrix.Color(Green,Red,Blue)};

// matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };//matrix.Color(Red, Green, Blue),

void setup() {

Serial.begin(115200);
ESP_BT.begin(9600);
EEPROM.begin();
initdata();
// Serial.println("Start");
const uint16_t colors[] = {matrix.Color(Green,Red,Blue)};
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(Brightness);
matrix.setTextColor(colors[0]);
//matrix.setTextColor(matrix.Color(Green,Red,Blue));
}

int x = matrix.width();
int pass = 0;

void loop() {

while(ESP_BT.available()){
char ReadChar = (char)ESP_BT.read();
Serial.println(ReadChar);

// Right parentheses ) indicates complet of the string
if(ReadChar == ')' ||ReadChar == '}' || ReadChar == ']'){
if(ReadChar == ')' ){
RGB_Completed = 1;
}
if(ReadChar == '}'){
RGB_Completed = 2;
}
if(ReadChar == ']'){
RGB_Completed = 3;
}
}
else{
RGB += ReadChar;
}

}
if(RGB_Completed!=0){
if(RGB_Completed==1){
Light_RGB_LED();
RGB_Completed=0;
}
if (RGB_Completed==2){
text=RGB;
int _size = text.length();
int i;
for(i=0;i<_size;i++)
{
EEPROM.write(50+i,text.charAt(i));
Serial.println(text.charAt(i));
}
EEPROM.write(50+_size,'\0'); //Add termination null character for String Data

RGB_Completed=0;
RGB="";
}
if (RGB_Completed==3){
int val=RGB.toInt();
if(val>0 && val<=100){
if(val==0){
val=1;
}
Delay=(100-val)*2.5;
//scroll(Delay);
EEPROM.write(0,Delay);
}
else{
val=val-100;
matrix.setBrightness(val);
EEPROM.write(5,val);
}

RGB="";
RGB_Completed=0;
}
}

if(RGB_Completed==0){
//. Serial.println(RGB_Completed);
scroll();
}

}

void scroll(){
//Serial.println(text);
int maxDisplacement = text.length() * pixelPerChar + matrix.width();
matrix.fillScreen(0);
matrix.setCursor(x, 0);

matrix.print(text);
if(--x < -maxDisplacement) {
x = matrix.width();

if(++pass >= 1){ pass = 0;
// matrix.setTextColor(colors[pass]);
matrix.setTextColor(matrix.Color(Green,Red,Blue));
// matrix.setTextColor(matrix.Color(Red,Green,Blue));
}
}

matrix.show();
delay(Delay);

}

void Light_RGB_LED(){

int SP1 = RGB.indexOf('.');
int SP2 = RGB.indexOf('.', SP1+1);
int SP3 = RGB.indexOf('.', SP2+1);
String R = RGB.substring(0, SP1);
String G = RGB.substring(SP1+1, SP2);
String B = RGB.substring(SP2+1, SP3);
Red=R.toInt();Green=G.toInt();Blue=B.toInt();
// Serial.println(R);
matrix.setTextColor(matrix.Color(Green,Red,Blue));
EEPROM.write(10,Red);EEPROM.write(15,Green);EEPROM.write(20,Blue);
RGB="";

}

and there is 1 more file as function of code which is

void initdata(){

int Speed=EEPROM.read(0);
if(Speed==NULL || Speed==0){
Delay=100;
}
else{
Delay=Speed;
}

int bright= EEPROM.read(5);
if(bright==NULL || bright==0){
Brightness=40;
}
else{
Brightness=bright;
}

int r= EEPROM.read(10);
if(r==NULL){
Red=0;
}
else{
Red=r;
}

int g= EEPROM.read(15);
if(g==NULL){
Green=255;
}
else{
Green=g;
}

int b= EEPROM.read(20);
if(b==NULL){
Blue=0;
}
else{
Blue=b;
}
char data[100]; //Max 100 Bytes
int len=0;
char k;
String Text= "";
k=EEPROM.read(50);
while(k != '\0' && len<500) //Read until null character
{
k=EEPROM.read(50+len);
data&#91
; len]=k;
Text+=k;
len++;
}
data[len]='\0';

if(Text==NULL){
text="EASY TECH";
}
else{
text=Text;
}
Serial.println(Speed);
Serial.println(Brightness);
Serial.println(Red);
Serial.println(Green);
Serial.println(Blue);
Serial.println(text);

}

please please please help

Your code has been corrupted by replacement of HTML character entity references.

For example, this line:

#include &lt;SoftwareSerial.h>

is supposed to be:

#include <SoftwareSerial.h>

< is the HTML character entity reference for <.

This may have been caused by the website the code was shared on or you may have copied the code in an incorrect manner.

If you can't find an uncorrupted source of the code, you'll need to replace all the character entity references with the real characters.

I gave it a try by just loading the code you posted as HTML and got this:

#include <SoftwareSerial.h>
#include "Arduino.h"
#include <Wire.h>//Include libraries: SoftwareSerial & Wire
SoftwareSerial ESP_BT(0,1); //Define PIN11 & PIN12 as RX and TX pins

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>

#ifndef PSTR
 #define PSTR // Make Arduino Due happy
#endif

#define PIN 5

// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
//   NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
//     Position of the FIRST LED in the matrix; pick two, e.g.
//     NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
//   NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
//     rows or in vertical columns, respectively; pick one or the other.
//   NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
//     in the same order, or alternate lines reverse direction; pick one.
//   See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_GRBW    Pixels are wired for GRBW bitstream (RGB+W NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)


// Example for NeoPixel Shield.  In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino.  When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order.  The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(
  32,                                              //Select LEDs of each row (15 in my case) 
  8,                                               //Select amount of rows (7 in my case)
  PIN,                                                
  NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT +           //Define first data pin (right bottom corner is my first pin)
  NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,             //Define the type of connection (in a zig zag connections and divided by rows not columns)
  NEO_RGB            + NEO_KHZ800);


  int Red=255,Green=0,Blue=0;
  String text="Easy Tech";
  String RGB;
  int pixelPerChar = 5,RGB_Completed=0;
  int Delay, Brightness;
const uint16_t colors[] = {matrix.Color(Green,Red,Blue)};

//  matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };//matrix.Color(Red, Green, Blue),


void setup() {
  
  Serial.begin(115200);
  ESP_BT.begin(9600);
  EEPROM.begin();
 initdata();
 // Serial.println("Start");
  const uint16_t colors[] = {matrix.Color(Green,Red,Blue)};
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(Brightness);
  matrix.setTextColor(colors[0]);
 //matrix.setTextColor(matrix.Color(Green,Red,Blue));
}

int x    = matrix.width();
int pass = 0;

void loop() {



  while(ESP_BT.available()){
    char ReadChar = (char)ESP_BT.read();
     Serial.println(ReadChar);
 
    // Right parentheses ) indicates complet of the string
    if(ReadChar == ')' ||ReadChar == '}' || ReadChar == ']'){
      if(ReadChar == ')' ){
      RGB_Completed = 1;
       }
      if(ReadChar == '}'){
       RGB_Completed = 2;
      }
      if(ReadChar == ']'){
       RGB_Completed = 3;
      }
    }
    else{
       RGB += ReadChar;
    }
    
  
  }
  if(RGB_Completed!=0){
      if(RGB_Completed==1){
             Light_RGB_LED();
             RGB_Completed=0;
         }
      if (RGB_Completed==2){
          text=RGB;
           int _size = text.length();
            int i;
          for(i=0;i<_size;i++)
         {
       EEPROM.write(50+i,text.charAt(i));
       Serial.println(text.charAt(i));
           }
      EEPROM.write(50+_size,'\0');   //Add termination null character for String Data
     
           RGB_Completed=0;
           RGB="";
        }
      if (RGB_Completed==3){
        int val=RGB.toInt();
        if(val>0 && val<=100){
          if(val==0){
            val=1;
          }
          Delay=(100-val)*2.5;
          //scroll(Delay);
          EEPROM.write(0,Delay);
        }
        else{
          val=val-100;
          matrix.setBrightness(val);
          EEPROM.write(5,val);
        }
       
        RGB=""; 
        RGB_Completed=0;
      }
    }

   if(RGB_Completed==0){
  //.  Serial.println(RGB_Completed);
    scroll();
  }

}

void scroll(){
  //Serial.println(text);
  int  maxDisplacement = text.length() * pixelPerChar + matrix.width();
  matrix.fillScreen(0);
  matrix.setCursor(x, 0);
  
  matrix.print(text);
  if(--x < -maxDisplacement) {
    x = matrix.width();
  
    if(++pass >= 1){ pass = 0;
   // matrix.setTextColor(colors[pass]);
     matrix.setTextColor(matrix.Color(Green,Red,Blue));
    //  matrix.setTextColor(matrix.Color(Red,Green,Blue));
    }
  }
  
  matrix.show();
  delay(Delay);
  
}



void Light_RGB_LED(){
 
  int SP1 = RGB.indexOf('.');
  int SP2 = RGB.indexOf('.', SP1+1);
  int SP3 = RGB.indexOf('.', SP2+1);
  String R = RGB.substring(0, SP1);
  String G = RGB.substring(SP1+1, SP2);
  String B = RGB.substring(SP2+1, SP3);
  Red=R.toInt();Green=G.toInt();Blue=B.toInt();
// Serial.println(R);
 matrix.setTextColor(matrix.Color(Green,Red,Blue));
  EEPROM.write(10,Red);EEPROM.write(15,Green);EEPROM.write(20,Blue);
 RGB="";
 
}

and there is 1 more file as function of code which is


void initdata(){

     int Speed=EEPROM.read(0);
     if(Speed==NULL || Speed==0){
      Delay=100;
       }
       else{
        Delay=Speed;
       }

    int bright=  EEPROM.read(5); 
     if(bright==NULL || bright==0){
      Brightness=40;
       }
       else{
        Brightness=bright;
       }

    int r=  EEPROM.read(10); 
     if(r==NULL){
        Red=0;
       }
       else{
        Red=r;
       }

    int g=  EEPROM.read(15); 
     if(g==NULL){
        Green=255;
       }
       else{
        Green=g;
       }

   int b=  EEPROM.read(20); 
     if(b==NULL){
        Blue=0;
       }
       else{
        Blue=b;
       }
  char data[100]; //Max 100 Bytes
   int len=0;
    char k;
   String Text= "";
  k=EEPROM.read(50);
  while(k != '\0' && len<500)   //Read until null character
  {    
    k=EEPROM.read(50+len);
    data[
; len]=k;
    Text+=k;
    len++;
  }
  data[len]='\0';
   
     if(Text==NULL){
        text="EASY TECH";
       }
       else{
        text=Text;
       }
Serial.println(Speed);
Serial.println(Brightness);
Serial.println(Red);
Serial.println(Green);
Serial.println(Blue);
Serial.println(text);
 
  }

That will get you started at least.

1 Like

If yo can share the website-adress where you have the code from. I can take a look at it.

You yourself can watch out for a a button or link like "raw" or "copy code"
The hardware seems to include a device from espressif. So a link to the project in general will help a lot to deliver information that is needed to help us to help you.
Best regards Stefan

@ieeshsawhney

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here

thank you sirs for your immediate response i will try but also as you adviced this is the site Smartphone Control RGB Scrolling Text Display LED Matrix - YouTube smartphone control rgb scrolling text display led matrix by easy tech
thanks and if you can advice any further really really thanks
regards

thank you pert for your response will work on it thanks thanks

Stefan
thank you have posted the site thanks for your help

now when i am uploading the code it is showing error

Please don't make us guess what the errors are.

The guy who put this code online has a website called "EASY-TECH" Now I would call it "LAZY-TECH".

The code putted online is bad formatted.

The code putted online is not pure code. This text contains HTML-characters which cause the compile-errors.
Then he has separated a funtion "initdata()" that is requiered too.

No single word about additional libraries that have to be installed and how to do this installing to make the code compile.

It does writings to the EEPROM. By this lazy guiy I would be not astonished if the writing to the eeprom occurs so often that the EEPROM wears out in a pretty short time. But I haven't done a deep analysis if this is true

So here is a code-version that does compile. I don't have the hardware so I can't test the real thing. As the TO has the hardware you could give it a try.

#include <SoftwareSerial.h>
#include "Arduino.h"
#include <Wire.h>//Include libraries: SoftwareSerial & Wire
SoftwareSerial ESP_BT(0, 1); //Define PIN11 & PIN12 as RX and TX pins

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>

#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif

#define PIN 5

// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
//   NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
//     Position of the FIRST LED in the matrix; pick two, e.g.
//     NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
//   NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
//     rows or in vertical columns, respectively; pick one or the other.
//   NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
//     in the same order, or alternate lines reverse direction; pick one.
//   See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_GRBW    Pixels are wired for GRBW bitstream (RGB+W NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)


// Example for NeoPixel Shield.  In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino.  When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order.  The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(
                              32,                                              //Select LEDs of each row (15 in my case)
                              8,                                               //Select amount of rows (7 in my case)
                              PIN,
                              NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT +           //Define first data pin (right bottom corner is my first pin)
                              NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,             //Define the type of connection (in a zig zag connections and divided by rows not columns)
                              NEO_RGB            + NEO_KHZ800);


int Red = 255, Green = 0, Blue = 0;
String text = "Easy Tech";
String RGB;
int pixelPerChar = 5, RGB_Completed = 0;
int Delay, Brightness;
const uint16_t colors[] = {matrix.Color(Green, Red, Blue)};

//  matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };//matrix.Color(Red, Green, Blue),

void initdata() {

  int Speed = EEPROM.read(0);
  if (Speed == NULL || Speed == 0) {
    Delay = 100;
  }
  else {
    Delay = Speed;
  }

  int bright =  EEPROM.read(5);
  if (bright == NULL || bright == 0) {
    Brightness = 40;
  }
  else {
    Brightness = bright;
  }

  int r =  EEPROM.read(10);
  if (r == NULL) {
    Red = 0;
  }
  else {
    Red = r;
  }

  int g =  EEPROM.read(15);
  if (g == NULL) {
    Green = 255;
  }
  else {
    Green = g;
  }

  int b =  EEPROM.read(20);
  if (b == NULL) {
    Blue = 0;
  }
  else {
    Blue = b;
  }
  char data[100]; //Max 100 Bytes
  int len = 0;
  char k;
  String Text = "";
  k = EEPROM.read(50);
  while (k != '\0' && len < 500)  //Read until null character
  {
    k = EEPROM.read(50 + len);
    data[len] = k;
    Text += k;
    len++;
  }
  data[len] = '\0';

  if (Text == NULL) {
    text = "EASY TECH";
  }
  else {
    text = Text;
  }
  Serial.println(Speed);
  Serial.println(Brightness);
  Serial.println(Red);
  Serial.println(Green);
  Serial.println(Blue);
  Serial.println(text);

}

void setup() {

  Serial.begin(115200);
  ESP_BT.begin(9600);
  EEPROM.begin();
  initdata();
  // Serial.println("Start");
  const uint16_t colors[] = {matrix.Color(Green, Red, Blue)};
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(Brightness);
  matrix.setTextColor(colors[0]);
  //matrix.setTextColor(matrix.Color(Green,Red,Blue));
}

int x    = matrix.width();
int pass = 0;

void loop() {

  while (ESP_BT.available()) {
    char ReadChar = (char)ESP_BT.read();
    Serial.println(ReadChar);

    // Right parentheses ) indicates complet of the string
    if (ReadChar == ')' || ReadChar == '}' || ReadChar == ']') {
      if (ReadChar == ')' ) {
        RGB_Completed = 1;
      }
      
      if (ReadChar == '}') {
        RGB_Completed = 2;
      }
      
      if (ReadChar == ']') {
        RGB_Completed = 3;
      }
    }
    
    else {
      RGB += ReadChar;
    }
  }
  
  if (RGB_Completed != 0) {
    if (RGB_Completed == 1) {
      Light_RGB_LED();
      RGB_Completed = 0;
    }
    
    if (RGB_Completed == 2) {
      text = RGB;
      int _size = text.length();
      int i;
      
      for (i = 0; i < _size; i++) {
        EEPROM.write(50 + i, text.charAt(i));
        Serial.println(text.charAt(i));
      }
      
      EEPROM.write(50 + _size, '\0'); //Add termination null character for String Data

      RGB_Completed = 0;
      RGB = "";
    }
    
    if (RGB_Completed == 3) {
      int val = RGB.toInt();
      if (val > 0 && val <= 100) {
        if (val == 0) {
          val = 1;
        }
        Delay = (100 - val) * 2.5;
        //scroll(Delay);
        EEPROM.write(0, Delay);
      }
      else {
        val = val - 100;
        matrix.setBrightness(val);
        EEPROM.write(5, val);
      }

      RGB = "";
      RGB_Completed = 0;
    }
  }

  if (RGB_Completed == 0) {
    //.  Serial.println(RGB_Completed);
    scroll();
  }
}


void scroll() {
  //Serial.println(text);
  int  maxDisplacement = text.length() * pixelPerChar + matrix.width();
  matrix.fillScreen(0);
  matrix.setCursor(x, 0);

  matrix.print(text);
  if (--x < -maxDisplacement) {
    x = matrix.width();

    if (++pass >= 1) {
      pass = 0;
      // matrix.setTextColor(colors[pass]);
      matrix.setTextColor(matrix.Color(Green, Red, Blue));
      //  matrix.setTextColor(matrix.Color(Red,Green,Blue));
    }
  }

  matrix.show();
  delay(Delay);
}


void Light_RGB_LED() {

  int SP1 = RGB.indexOf('.');
  int SP2 = RGB.indexOf('.', SP1 + 1);
  int SP3 = RGB.indexOf('.', SP2 + 1);
  String R = RGB.substring(0, SP1);
  String G = RGB.substring(SP1 + 1, SP2);
  String B = RGB.substring(SP2 + 1, SP3);
  Red = R.toInt(); Green = G.toInt(); Blue = B.toInt();
  // Serial.println(R);
  matrix.setTextColor(matrix.Color(Green, Red, Blue));
  EEPROM.write(10, Red); EEPROM.write(15, Green); EEPROM.write(20, Blue);
  RGB = "";

}

I wrote this guy a feedback about his lazyness. If you want to do me a favour you write him a description of what with his version does happen asking this guy for help.

best regards Stefan

2 Likes

Hi ieeshsawhney,

as a general rule: you should provide as much information as possible. If you are unsure about what kind of information At the very least by asking

"what do I have to post as information to enable helpers to help?"

If errors occur it is very important what the error says.

Next thing to do is installing the libraries

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>

so let the librarie-manager of the Arduino-IDE do a search for "GFX" and for "NeoMatrix"
if any errors occur when you try to compile click the "copy errors" button and post the errormessages as a code-section.
I have done a lot of work for you. As a "thank you" read how to post code as a code-section in the sticky threads

https://forum.arduino.cc/index.php?topic=97455.0

https://forum.arduino.cc/index.php?topic=97455.0

best regards Stefan

Hi StefanL38, please review your link-posting skills.

thanks steffanl38 will definitely do the at least others should know and benefitted of your work and if they buy such items they will be left stranded thanks a million
regards

TheMemberFormerlyKnownAsAWOL:
Hi StefanL38, please review your link-posting skills.

To be a good role model I improved the links to be interactive

by the way do have Autohotkey-scripts handy that do type all the details needed for inserting one of the standard-links. Autohotkey can reduce the work down to type a short acronym like "GenG" for general guidance
and "PrgQ" for programming question... and then autohotkey will type all the characters nescessary for insert the clickable link and a descriptive name for the link

best regards Stefan

StefanL38:
To be a good role model I improved some of the links to be interactive

sorry everyone for my mistake of not posting the errors I got it was seriously my mistake will rectify it next time
and thanks for pointing it out
special thanks to Stefanl38 for pointing out my mistake but still helping me out
sorry
thanks
regards

stefan i posted your code it is showing this error
void Light_RGB_LED() {
a function-definition is not allowed here before '{' token
exit status 1

it is inbetween this code
if (++pass >= 1) {
pass = 0;
// matrix.setTextColor(colors[pass]);
matrix.setTextColor(matrix.Color(Green, Red, Blue));
// matrix.setTextColor(matrix.Color(Red,Green,Blue));
}
}

matrix.show();
delay(Delay);
}

void Light_RGB_LED() { --------------------------------------<

int SP1 = RGB.indexOf('.');
int SP2 = RGB.indexOf('.', SP1 + 1);
int SP3 = RGB.indexOf('.', SP2 + 1);
String R = RGB.substring(0, SP1);

also if i insert { before void it keeps on giving this error before many codes

so definitely i did wrong can you advice

Post all your code.
In code tags.

#include <SoftwareSerial.h>
#include "Arduino.h"
#include <Wire.h>//Include libraries: SoftwareSerial & Wire
SoftwareSerial ESP_BT(0,1); //Define PIN11 & PIN12 as RX and TX pins

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>

#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif

#define PIN 5

// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
// NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
// Position of the FIRST LED in the matrix; pick two, e.g.
// NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
// NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
// rows or in vertical columns, respectively; pick one or the other.
// NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
// in the same order, or alternate lines reverse direction; pick one.
// See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_GRBW Pixels are wired for GRBW bitstream (RGB+W NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

// Example for NeoPixel Shield. In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino. When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order. The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(
32, //Select LEDs of each row (15 in my case)
8, //Select amount of rows (7 in my case)
PIN,
NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT + //Define first data pin (right bottom corner is my first pin)
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, //Define the type of connection (in a zig zag connections and divided by rows not columns)
NEO_RGB + NEO_KHZ800);

int Red=255,Green=0,Blue=0;
String text="Easy Tech";
String RGB;
int pixelPerChar = 5,RGB_Completed=0;
int Delay, Brightness;
const uint16_t colors[] = {matrix.Color(Green,Red,Blue)};

// matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };//matrix.Color(Red, Green, Blue),

void setup() {

Serial.begin(115200);
ESP_BT.begin(9600);
EEPROM.begin();
initdata();
// Serial.println("Start");
const uint16_t colors[] = {matrix.Color(Green,Red,Blue)};
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(Brightness);
matrix.setTextColor(colors[0]);
//matrix.setTextColor(matrix.Color(Green,Red,Blue));
}

int x = matrix.width();
int pass = 0;

void loop() {

while(ESP_BT.available()){
char ReadChar = (char)ESP_BT.read();
Serial.println(ReadChar);

// Right parentheses ) indicates complet of the string
if(ReadChar == ')' ||ReadChar == '}' || ReadChar == ']'){
if(ReadChar == ')' ){
RGB_Completed = 1;
}
if(ReadChar == '}'){
RGB_Completed = 2;
}
if(ReadChar == ']'){
RGB_Completed = 3;
}
}
else{
RGB += ReadChar;
}

}
if(RGB_Completed!=0){
if(RGB_Completed==1){
Light_RGB_LED();
RGB_Completed=0;
}
if (RGB_Completed==2){
text=RGB;
int _size = text.length();
int i;
for(i=0;i<_size;i++)
{
EEPROM.write(50+i,text.charAt(i));
Serial.println(text.charAt(i));
}
EEPROM.write(50+_size,'\0'); //Add termination null character for String Data

RGB_Completed=0;
RGB="";
}
if (RGB_Completed==3){
int val=RGB.toInt();
if(val>0 && val<=100){
if(val==0){
val=1;
}
Delay=(100-val)*2.5;
//scroll(Delay);
EEPROM.write(0,Delay);
}
else{
val=val-100;
matrix.setBrightness(val);
EEPROM.write(5,val);
}

RGB="";
RGB_Completed=0;
}
}

if(RGB_Completed==0){
//. Serial.println(RGB_Completed);
scroll();
}

}

void scroll(){
//Serial.println(text);
int maxDisplacement = text.length() * pixelPerChar + matrix.width();
matrix.fillScreen(0);
matrix.setCursor(x, 0);

matrix.print(text);
if(--x < -maxDisplacement) {
x = matrix.width();

if(++pass >= 1){ pass = 0;
// matrix.setTextColor(colors[pass]);
matrix.setTextColor(matrix.Color(Green,Red,Blue));
// matrix.setTextColor(matrix.Color(Red,Green,Blue));
}
}

matrix.show();
delay(Delay);

}

void Light_RGB_LED(){ --------------------------------------------------------------

int SP1 = RGB.indexOf('.');
int SP2 = RGB.indexOf('.', SP1+1);
int SP3 = RGB.indexOf('.', SP2+1);
String R = RGB.substring(0, SP1);
String G = RGB.substring(SP1+1, SP2);
String B = RGB.substring(SP2+1, SP3);
Red=R.toInt();Green=G.toInt();Blue=B.toInt();
// Serial.println(R);
matrix.setTextColor(matrix.Color(Green,Red,Blue));
EEPROM.write(10,Red);EEPROM.write(15,Green);EEPROM.write(20,Blue);
RGB="";

}

and there is 1 more file as function of code which is

void initdata(){

int Speed=EEPROM.read(0);
if(Speed==NULL || Speed==0){
Delay=100;
}
else{
Delay=Speed;
}

int bright= EEPROM.read(5);
if(bright==NULL || bright==0){
Brightness=40;
}
else{
Brightness=bright;
}

int r= EEPROM.read(10);
if(r==NULL){
Red=0;
}
else{
Red=r;
}

int g= EEPROM.read(15);
if(g==NULL){
Green=255;
}
else{
Green=g;
}

int b= EEPROM.read(20);
if(b==NULL){
Blue=0;
}
else{
Blue=b;
}
char data[100]; //Max 100 Bytes
int len=0;
char k;
String Text= "";
k=EEPROM.read(50);
while(k != '\0' && len<500) //Read until null character
{
k=EEPROM.read(50+len);
data[
; len]=k;
Text+=k;
len++;
}
data[len]='\0';

if(Text==NULL){
text="EASY TECH";
}
else{
text=Text;
}
Serial.println(Speed);
Serial.println(Brightness);
Serial.println(Red);
Serial.println(Green);
Serial.println(Blue);
Serial.println(text);

}

full code
error is shown as ----------------------------------------- for easy refrence
the error i am getting is
void Light_RGB_LED() {
a function-definition is not allowed here before '{' token
exit status 1

data[
; len]=k;

That leapt off the page at me.

Please remember to use code tags when posting code.

The IDE's auto-format tool is very helpful too.

sir i ran auto format tool but it did not correct the mistake so i changed it to
data[len] = k; is it wrong as still shows error
i also tried data[len] = 'k' ;