Plz someone help me control my arduino

plz someone help me control my Arduino by Matlab i have to give my project to tech tomorrow and im really wake up for 27 hours try to do something with Matlab i don't understand anything on Matlab
my code is
#include <Servo.h>
Servo myServo;
int servopos = 0;
int motionPin = 4;
int Led = 8;

void setup() {
myServo.attach(9);
myServo.write(0);
Serial.begin(9600);
pinMode (motionPin,INPUT);
pinMode(Led,OUTPUT);
}

void loop() {
int readValue = digitalRead(motionPin);
if(readValue == 1){
OpenDoor();
digitalWrite(Led,HIGH);
Serial.print (digitalRead(motionPin));
Serial.println(" ON ");
delay(5000);
}
else{
CloseDoor();
digitalWrite(Led,LOW);
Serial.print (digitalRead(motionPin));
Serial.println(" OFF ");
}
}

void OpenDoor() {
while(servopos <110){
servopos++;
myServo.write(servopos);
delay(10);
}
}
void CloseDoor() {
while(servopos >0){
servopos--;
myServo.write(servopos);
delay(10);
}
}

What's the problem?

Please remember to use code tags when posting code

If your problem is with Matlab, then it would be sheer luck for you to get help here, if another Arduino user happened to be a bit of a Matlab guru.

Surely if the problem is Matlab-related you could get help on a Matlab forum (assuming there is such a thing....)

Or, since it's a tech project (is that a college?) then surely the faculty is paid to help you?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.