Thanks for the post. There where some problems with my account on the new forum. But now it works. I didn’t have the chance testing your code. I ordered a new data cable, but I didn’t received it yet. The other data cable is in use in another project.
Here is my code you asked for.
#include <NewSoftSerial.h>
NewSoftSerial mySerial(2, 3);//(rxpin, txpin ) green from usb is Rx, white from usb is Tx. So green form usb ( from phone ) is connected with pin 3, white with pin 2.
//use a voltage diveder, the T68i use 3.3V.
int sensPin=0; // analog pin 0 gebruikt om licht sensor in te lezen
int val = 0;// analoge waarde wordt weggeschreven in val
int runonce = 0;// geheugen om maar 1 maal een sms te sturen. Men moet dus de mic resetten wil men het programma terug laten lopen om een sms te sturen
int detect1=0;
int detect2=0;
void setup()
{
Serial.begin(9600);
Serial.println("Send SMS with T68");
// set the data rate for the NewSoftSerial port
mySerial.begin(9600);
pinMode(13, OUTPUT);// pin 13 geeft aan wanneer de brander in nood gegaan is
}
void loop() // run over and over again
{
if (mySerial.available()) {
Serial.print((char)mySerial.read());
}
if (Serial.available()) {
mySerial.print((char)Serial.read());
}
val = analogRead(sensPin);
//Serial.println(val);// gebruik dit om de lichtsensor af te regelen op de brander
if ((val>260)&&(detect2==1))
{
runonce=1;
}
if((val>260)&&(detect1==0))
{
delay(8000);
detect2=1;
}
else
{
detect2=0;
}
if ( (val > 260)&&(runonce==1) )
{
runonce=0;
digitalWrite(13, HIGH);
//Serial.println("send sms");//test zenden sms
mySerial.println("ati");
delay(3000);
mySerial.println("AT+CMGF=0"); // Set PDU mode
delay(3000);
mySerial.println("AT+CMGS=31"); // Number of octets
delay(3000);
mySerial.print("0011000B912374276628F50000AA134279D84D2ECB41D524F558B40699CCA213"); // Sends "Brander UITGEVALLEN" to "+32477266825"
delay(3000);
byte ctrlz = 26;
mySerial.print(ctrlz);
delay(3000);
detect1=1;
detect2=0;
}
}
Excuse me! I am a beginner and would like to see the source code to send an sms with Sony Ericsson T230 by Arduino
I put, Rx = 8, and TX = 10
I searched on Google and I found this site and do not quite understand! waiting for a reply as soon as possible!
//Set memory to read sms from, ME = phone memory
Serial.println("AT+CPMS="ME"");
}
void loop() {
delay(3000);
//Read received message
Serial.println("AT+CMGR=1");
delay(3000);
//Delete all read messages
Serial.println("AT+CMGD=1");
// read phone reply if available
if (Serial.available() > 0) {
incomingByte = Serial.read(), BYTE;
// say what you got:
Serial.println(incomingByte);
}
}
I'm trying read messages with a T68i too and i'm using the code that Hulk sent above.
So, in the Serial Monitor i get:
AT+CPMS="ME"
AT+CMGR=1
A
AT+CMGR=1
T
AT+CMGR=1
+
AT+CMGR=1
C
AT+CMGR=1
P
AT+CMGR=1
M
AT+CMGR=1
S
AT+CMGR=1