hi i want to send integer from matlab to arduino but...

hi i want to send integer from matlab to arduino but it was not working

i make led display by using tlc 5940 pwm controller and 74595 shift register.

to send integer to arduino, i use serial communication and use atoi function.

but it wasn’t working

pleas help

this is arduino code

#include <Tlc5940.h>
#include <tlc_config.h>
#include <tlc_fades.h>
#include <stdlib.h>
#include <stdio.h>

int DataPin=7;
int LatchPin=6;
int ClockPin=5;
long data[8][8];
long data1[8][8];
char col[8][8];
byte row[8]={B00000001,B00000010,B00000100,B00001000,B00010000,B00100000,B01000000,B10000000};

void setup(){
  Serial.begin(2000000);
  Tlc.init(0);
  pinMode(LatchPin,OUTPUT);
  pinMode(ClockPin,OUTPUT);
  pinMode(DataPin,OUTPUT);
}
void normalization(){
  for(int e=0;e<8; e++)
  {
    for(int f=0; f<8; f++)
    {
      data1[e][f] = floor(((data[e][f])/255)*4095);           
    }
  }
} 
void loop() {
  while(Serial.available()){
    for(int a=0;a<8;a++){
     for(int b=0 ;b<8;b++){
      col[b][a] = (char)Serial.read() ;
      delay(10);
      data[b][a] = atol( col[b][a] );   
       
     } 
  }
  normalization();
  }
  Serial.println(col[1][1]);
  delay(100);
  for(int i=0;i<8;i++){
  digitalWrite(LatchPin,LOW);
  shiftOut(DataPin,ClockPin,LSBFIRST,row[i]);  
  digitalWrite(LatchPin,HIGH); 
  digitalWrite(10,HIGH); 
  for(int c=1;c<9;c++){ 
     Tlc.set(c,data1[i][c-1]);          
  }
  Tlc.update();
  digitalWrite(10,LOW);
  Tlc.clear();
  delay(1);
   
  }         
 
}
close all;
clear all; 
delete(instrfindall)
s = serial('COM4', 'baudrate', 2000000);
fopen(s);
pause(2);                           
A = [100 100 250 250 100 100 100 100 100 250 250 250 250 100 100 100 100 250 250 250 250 250 100 100 100 100 250 250 250 250 250 100 100 100 250 250 250 250 250 100 100 250 250 250 250 250 100 100 100 250 250 250 250 100 100 100 100 100 250 250 100 100 100 100 ];  %% 입력 데이터

   for j=1:64
       fprintf(s,'%s',char(A(j))); 
    
   end

delete(instrfindall)

and this is matlab code…

You already have answers on this topic.

Do not cross-post.

Thread locked.