Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Matlab to Arduino
Replies: 1   Last Post: Jul 10, 2013 5:26 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Rak

Posts: 35
Registered: 3/30/12
Matlab to Arduino
Posted: Jul 10, 2013 5:10 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I want to send a set of values say 1,2 from matlab to Arduino.
My matlab code for sending values is as follows
fopen (s)
for i = 1:2
fwrite(s, i, 'uint8');
end
fclose(s);

Arduino side: i want to receive these 2 values : 1 and 2.

int Data;

void setup()
{
Serial.begin(9600);
}

void loop()
{
if(Serial.available()>0)
{
Data=Serial.read();

if(Data==1) {
Serial.println("hello1"); }
else if(Data==2){
Serial.println("hello2"); }
}
}

Problem: The values sent from matlab is not received in arduino. Any body please help me where i went wrong. Please help.!!!


Date Subject Author
7/10/13
Read Matlab to Arduino
Rak
7/10/13
Read Re: Matlab to Arduino
Rak

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.