How to call the arduino code from the labview to perform the defined task?

Hello all,

I working on project where I have to light up the four corners of the LED matrix 32*32.

So I am using LED matrix 32*32 from adafruit and arduino uno to control the LED pattern.

and this task is the first small task of the big project.

because I have made VI into the labview and it is intended to function this way(it illuminates the sample then camera takes the images of the sample, later it does image processing detects the cellls and scans the detected cell) and repeat the same cycle again and again.

So I have to call the arduino code from the labview to perform the programmed task of lighting up the four corners of the LED matrix after when the previous cycle finished.

So I want to send the one byte of the signal to the arduino to perform the task.

My arduino programme,

I am using RGBMATRIX library and adafruit library

then I define the pin 13 as ledPin to get the one byte of signal.
then I used if function , so if that pin is HIGH then perform the defined task and else keep all LEDs off.

I have pasted the code here,

So if some one knows how to call the arduino programme from the LabVIEW then it would be very helpful.

#include <Adafruit_GFX.h>
#include <RGBmatrixPanel.h>

#define CLK  8   // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc.
#define OE   9
#define LAT 10
#define A   A0
#define B   A1
#define C   A2
#define D   A3
#define ledPin  13   // pin defined to get the byte of signal 


RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);

void setup() {

  matrix.begin();
  pinMode(ledPin,OUTPUT); // sets the digital pin 13 as output

}

void loop() {


          
      digitalWrite(ledPin,OUTPUT);   
          
          if(ledPin == HIGH){
            matrix.fillRect(0, 0, 16, 16, matrix.Color333(7, 7, 7));
            delay(1000);
            matrix.fillRect(0, 0, 32, 32, matrix.Color333(0, 0, 0));
            delay(500);
 
            matrix.fillRect(0, 16, 16, 32, matrix.Color333(7, 7, 7));
            delay(1000);
            matrix.fillRect(0, 0, 32, 32, matrix.Color333(0, 0, 0));
            delay(500);
  
            matrix.fillRect(16, 16, 32, 32, matrix.Color333(7, 7, 7));
            delay(1000);
            matrix.fillRect(0, 0, 32, 32, matrix.Color333(0, 0, 0));
            delay(500);
 
            matrix.fillRect(16, 0, 32, 16, matrix.Color333(7, 7, 7));
            delay(1000);
          }

          if(ledPin == LOW) {
            matrix.fillRect(0, 0, 32, 32, matrix.Color333(0, 0, 0));
           delay(2000);     
            
          }
          
          
          

}

I also have attached the image which shows how I have to light up the LEDs.

I also tried arduino functions in labview still not getting what I need.

Your query is not about leds, is about communicating with labview, correct? So this forum section is not the best place to ask your question. I suggest you click "Report to moderator" and request that your thread is moved to the "Interfacing w/ Software on the Computer" section. Good luck.

You can't call an Arduino program. As long as the Arduino is on, the program loaded in the Arduino is running.

You will have to send commands from matlab (e.g. via the serial port) to the Arduino. Those commands can be simple numbers or whatever. E.g <1,0> can be a command to switch the first led off and <1,1> can be a command to switch the first led on.

You have to modify the Arduino side of your code so it can read the data and take action.

See serial input basics for ideas.