how to get weight form Weight Scale and ek 300i

I was tried add new code.

        Serial.print("Char received  ");   //NEW
        Serial.write( (byte) rc);     //NEW
        Serial.println();   //NEW

out put is.
link to image

and I connect to scale by IC MAX232CPE.
I use 2 pieces of rs232 because I want to recive wieght and send to thermal Printer
I use the frist rs232 to connect to scale.
pin2 rx pin3tx pin5 GNd
link to image.

I can't read your picture. Please post the output from the program as text - just copy and paste,

And I have a feeling that the diagram of the MAX232 is not one that you made yourself to show exactly how YOU have everything connected.

...R

out put is a language I do not know. It is a square box.

<Arduino is ready>
Char received  square box
Char received  square box
Char received  square box

ardiono

Gray wire 5V to max232cpe (on power pin zone)
Black wire GND to max232cpe (on power pin zone)
yellow wire tx to max232cpe (on communication pin zone)
Green wire rx to max232cpe (on communication pin zone)
yellow2 wire tx to max232cpe (on communication pin zone)
Green2 wire rx to max232cpe (on communication pin zone)
Gray wire2 Gnd to 7segment (on digital pin zone)
White wire 5v to 7segment (on digital pin zone)

MAX232CPE PCB
blue wire >> pin 3 rs232
purple wire >> pin 2 rs232
blue wire >> pin 3 rs232 2
purple wire >> pin 2 rs232 2
Black wire >> Pin 5 rs232
Black wire >> arduino GND
Black wire >> Pin 5 rs232 2
Green wire >> arduino rx1
Green wire2 >> arduino rx2
Yellow wire >> arduino tx1
Yellow wire2 >> arduino tx2
5V arduino >>Gray wire >>max232cpe

Sometime, out put is.

<Arduino is ready>
Char received  
Char received  
Char received  
Char received  
Char received  B
Char received  @

I edit max232cpe diagram for you.
the original diagram.

Sorry, I had a mistake in the extra code I asked you to insert.

Change

Serial.write( (byte) rc);     //NEW

to

Serial.print( (byte) rc);     //NEW

and try again. It should print the ASCII values of the characters being received.

I appreciate that you have taken a lot of trouble to post pictures but I'm afraid it was all in vain as they do not tell what I need to know. A photo of a simple pencil drawing showing how everything is connected is all that is required.

...R

Hello, today I am edit code follow your advice.
I edit

Serial.write("Char received  ");

to

Serial.print("Char received  ");

Out put is "" only
I think it is not connect to the weight scale. how to fix it.

this is my all code

const byte numChars = 32;
char receivedChars[numChars]; 
boolean newData = false;

void setup() {
Serial2.begin(2400);
Serial.begin(9600);
Serial.println("<Arduino is ready>");
}

void loop() {
recvWithEndMarker();
showNewData();

}



void recvWithEndMarker() {
    static byte ndx = 0;
    char endMarker = '\n';
    char rc;

        while (Serial2.available() > 0 && newData == false) {
        rc = Serial2.read();
        Serial.print("Char received  ");   //NEW
        Serial.print( (byte) rc);     //NEW
        Serial.println();   //NEW
        
        if (rc != endMarker) {
            receivedChars[ndx] = rc;
            ndx++;
            if (ndx >= numChars) {
                ndx = numChars - 1;
            }
        }
        else {
            receivedChars[ndx] = '\0'; // terminate the string
            ndx = 0;
            newData = true;
        }
    }
       
}

void showNewData() {
    if (newData == true) {
        Serial.print("This just in ... ");
        Serial.println(receivedChars);
        newData = false;
    }
}

pen drawing showing my device connect

In your Reply #23 you showed a few lines starting with Char received. You should also be getting those lines with the code in Repy #26 if the ONLY change between the two programs was the one I recommended in Reply #25

Back in Reply #17 you were using Serial1 to talk to the scale but in Reply #23 it is Serial2. Did you change the pins the scale is connected to? Or is it still connected to Serial1?

Your diagram in Reply #26 is a step in the right direction but you need to develop it to show each individual wire and which pin it is connected to.

...R

When i use serial1 i use tx1 rx1 pin and When i use serial2 i use tx2 rx2 pin .
Output in DEC
Serial.print( rc,DEC);

<Arduino is ready>
Char received  85
Char received  83
Char received  -84
Char received  45
Char received  48
Char received  48
Char received  48
Char received  48
Char received  48
Char received  46
Char received  54
Char received  -72
Char received  -96
Char received  -96
Char received  -25
Char received  -115
Char received  10
This just in ... US⸮-00000.6⸮⸮⸮⸮

Out put in byte

Serial.print( (byte) rc); 
<Arduino is ready>
Char received  S
Char received  ⸮
Char received  ⸮
Char received  -
Char received  0
Char received  0
Char received  0
Char received  0
Char received  0
Char received  .
Char received  5
Char received  6
Char received  ⸮
Char received  ⸮
Char received  ⸮
Char received  ⸮
Char received  

This just in ... SԬ-00000.56⸮⸮⸮

My out put today

l2eserved:
Output in DEC
Serial.print( rc,DEC);

Out put in byte

Serial.print( (byte) rc);

It looks like you have made another change to your program. Please post the full program (or programs) that produced the two outputs that you have shown in Reply #28. I can't see your PC screen from here.

...R

I do not chang my code but I chang my Circuits of max232cpe.

const byte numChars = 32;
char receivedChars[numChars]; 
boolean newData = false;

void setup() {
Serial1.begin(2400);
Serial.begin(9600);
Serial.println("<Arduino is ready>");
}

void loop() {
recvWithEndMarker();
showNewData();

}

void recvWithEndMarker() {
    static byte ndx = 0;
    char endMarker = '\n';
    char rc;
 
        while (Serial1.available() > 0 && newData == false) {
        rc = Serial1.read();
        Serial.print("Char received  ");   //NEW
        Serial.print( (byte) rc);      //I chang this to Serial.print(  rc,DEC);  
        Serial.println();   //NEW
        
        if (rc != endMarker) {
            receivedChars[ndx] = rc;
            ndx++;
            if (ndx >= numChars) {
                ndx = numChars - 1;
            }
        }
        else {
            receivedChars[ndx] = '\0'; // terminate the string
            ndx = 0;
            newData = true;
        }
    }

       
}

void showNewData() {
    if (newData == true) {
        Serial.print("This just in ... ");
        Serial.println(receivedChars);
        newData = false;
        delay(5000);
    }
}

scale monitor show 91.35
Some numbers is Unknown language resemble box
example
num 1 is ⸮
num 2 is ⸮
num 4 is ⸮
num 7 is ⸮
num 8 is ⸮
num 0 can show
num 3 can show
num 5 can show
num 6 can show
num 9 can show
out put Serial monitor is

This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮
This just in ... SԬ+0009⸮.35⸮⸮⸮

l2eserved:
I do not chang my code

then why do I see this in your program

//I chang this to Serial.print(  rc,DEC);

but I chang my Circuits of max232cpe.

How am I supposed to know what is going on as you have not posted a proper diagram for the circuit either before or after this change.

I am finding it very frustrating trying to help with your project. You seem to be jumping around all over the place rather than taking a methodical step-by-step approach.

If I can get time I will try the code you posted in Reply #30 and DO NOT make any more changes to it.

...R

I have succeeded in receive data.
I use Serial1.begin(2400, SERIAL_7N1);

thank you for you so much.