Can anyone help me with my thesis?

How will i send this set of codes into arduino? then arduino will try to send this commands into my gsm shield, can anyone send me some sketch? im using arduino uno

this codes are from vb:
Try
With SerialPort1
.PortName = comports
.BaudRate = 9600
.Parity = Parity.None
.StopBits = StopBits.One
.DataBits = 8
.Handshake = Handshake.RequestToSend
.DtrEnable = True
.RtsEnable = True
.NewLine = vbCrLf
.Open()
End With
Catch ex As Exception

End Try
Try
If SerialPort1.IsOpen Then
With SerialPort1
.Write("AT" & vbCrLf)
.Write("AT+CMGF=1" & vbCrLf)
.Write("AT+CMGS=" & Chr(34) & tbnumber.Text & Chr(34) & vbCrLf)
.Write(textmessage.Text & Chr(26))
MsgBox("Message Sent")

End With

Else
MsgBox("Error on the Port")
End If

Catch ex As Exception
MsgBox(ex.Message)
End Try

Please use code tags when posting code; edit your post and

type
** **[code]** **
before your code
type
** **[/code]** **
after your code

It is not advisable to throw exceptions away as you do in the first try/catch as you don't know what goes wrong.

I suggest that you read Serial Input Basics - updated to get ideas how to receive your data and place it in a buffer. Example 2 will probably do in which case you might want to change your VB code to only send a LF and not CR and LF. Example 3 will make the communication more reliable but requires more changes in your VB code.

Once you have received one command (e.g. AT), you can send that to the GSM using SoftwareSerial (if your shield uses serial communication). Next wait for the next command to arrive (AT+CMGF=1) and send that to the GSM in the same way.

I have no experience with GSM, you might have to wait for replies from the shield after you have send a command and possibly pass that reply to your VB code.

Which shield are you using?

If you use my code (and please feel free to do so) I hope I get a mention in the footnotes to your Thesis. @sterretje deserves a mention also.

...R

Here is a couple of functions that I picked up along the way from somewhere for dealing with GSM modules.

boolean sendATcommand(char* ATcommand, char* expectedAnswer, unsigned int timeout, uint8_t bufferSize) {
  char response[bufferSize];
  sendATCommandResponse(ATcommand, expectedAnswer, timeout, bufferSize, response);
  if (strlen(response) == 0) {
    return false;
  } else {
    return true;
  }
}

boolean sendATCommandResponse(char* command, char* endText, unsigned int timeout, uint8_t bufferSize, char* response) {
  memset(response, END_OF_STRING, bufferSize);
  uint8_t bufferPointer=0;
  unsigned long startMillis;
  
  clearSerialBuffer();

  sendLn(command);
  startMillis = millis();

  do {
    if (Serial1.available() != 0) {    
      response[bufferPointer++] = Serial1.read();
      bufferPointer = bufferPointer % bufferSize;
      if (strstr(response, endText) != NULL) {
        return true;
      }
    }
  } while((millis() - startMillis) < timeout);
  response[0] = END_OF_STRING;
  
  return false;
}

void send(char* text) {
  Serial1.print(text);
}

void sendLn(char* text) {
  Serial1.println(text);
}

void clearSerialBuffer() {
  while(Serial1.available() > 0) {
    Serial1.read();
  }  
}

And a rough idea of how you can use them:

#define AT ("AT")
#define AT_IDENTIFY ("ATI")
#define OK ("OK")

void doSomething() {
    if (sendATcommand(AT, OK, 200, 10)) {
        // success
    } else {
        // failure
    }
}