Buenas, tengo una aplicacion en vb6, debo enviarle al Arduino mega un nro de telefono, lo envio pero no hace nada,
codigo VB6
Dim txt As String Dim bytes() As Byte Dim i As Integer With MSComm1 .CommPort = 5 .Settings = "9600,N,8,1" .Handshaking = comRTS .RTSEnable = True .DTREnable = True .RThreshold = 2 .SThreshold = 3 .InputMode = comInputModeBinary .InputLen = 0 .PortOpen = True 'must be the last End With
' lo convierto a Bytes txt = txtMessage.Text bytes = StrConv(txt, vbFromUnicode) txt = "" For i = LBound(bytes) To UBound(bytes) txt = txt & Format$(Hex$(bytes(i)), "00") & " " Next i MSComm1.Output = txtMessage.Text
codigo Arduino
char mobilenumber; // Replace xxxxxxxx with the recipient's mobile number
void setup() { Serial.begin(9600); Serial.flush(); Serial1.begin(9600); //GSM Serial.println("Em comunicacao..."); delay(15000); // give the GSM module time to initialise, locate network etc. }
void loop() {//GSM //If a character comes in from the cellular module...
if(Serial1.available() >0){ //incoming_char=Serial1.read(); //Get the character from the cellular serial port. mobilenumber=Serial1.read();
//Serial.print(incoming_char); //Print the incoming character to the terminal.
}//If a character is coming from the terminal to the Arduino...
}
Serial1.println("AT+CMGF=1"); // set SMS mode to text Serial1.print("AT+CMGS="); Serial1.print(34,BYTE); // ASCII equivalent of " Serial1.print(mobilenumber); Serial1.println(34,BYTE); // ASCII equivalent of " delay(500); // give the module some thinking time Serial1.print("dime si llego el msg"); Serial1.println(26,BYTE); // ASCII equivalent of Ctrl-Z delay(10000); // the SMS module needs time to return to OK status Serial.print("Msg enviada desde vb.net");
do // loop temp just to test sketch { delay(1); } while (1>0); }
alguien podra ayudarme,gracias