unable to receive data in arduino from matlab
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I have tried to send integer from matlab to arduino
my matlab code is
clc;
clear all;
close all;
s=serial('COM4','BAUDRATE',9600);
fopen(s);
fprintf(s,'%i',1);
fclose(s);
and my arduino code is
void setup()
{
    Serial.begin(9600);
    }
void loop()
{
    if(Serial.available()>0)
    {
        int b=Serial.read();
        if(v==1)
        {
            Serial.println(v);
            }
        else
            {
                Serial.println(v);
                }
        }
    }
After uploading it to arduino uno and clicking on serial monitor i am not getting any output. its just blank

Is there any mistake in my code or my connectivity process??
5 comentarios
  Sravani Vanama
 el 20 de Nov. de 2019
				
      Editada: Sravani Vanama
 el 20 de Nov. de 2019
  
			
		
  Walter Roberson
      
      
 el 20 de Nov. de 2019
				s=serial('COM4','BAUDRATE',9600);
fopen(s);
fwrite(s, uint8(1));
fclose(s);
Respuestas (0)
Ver también
Categorías
				Más información sobre MATLAB Support Package for Arduino Hardware en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!