Hi!
I’m using FEZ Spider with .NET Micro Framework 4.1. I have downloaded the CellularRadio.cs file from Gadgeteer site on CodePlex and I have manually added it to my project.
I have written the following code:
// This method is run when the mainboard is powered up or reset.
void ProgramStarted()
{
cellularRadio = new CellularRadio(4);
cellularRadio.DebugPrintEnabled = true;
cellularRadio.PowerOn(5);
cellularRadio.SmsReceived += new CellularRadio.SmsReceivedHandler(cellularRadio_NewSMSEvent);
cellularRadio.SmsRetrieved += new CellularRadio.SmsRetrievedHandler(cellularRadio_SMSReady);
cellularRadio.ModuleInitialized += new CellularRadio.ModuleInitializedHandler(cellularRadio_ModuleInitialized);
// Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
Debug.Print("Program Started");
}
void cellularRadio_ModuleInitialized(CellularRadio sender)
{
Debug.Print("MODULE INITIALIZED");
}
void cellularRadio_SMSReady(CellularRadio sender, CellularRadio.Sms message)
{
if (message != null)
{
Debug.Print("RETRIEVED");
Debug.Print("FROM: " + message.TelephoneNumber);
Debug.Print("MSG: " + message.TextMessage);
Debug.Print("WHEN: " + message.Timestamp);
Debug.Print("STATUS: " + message.Status);
Debug.Print("POS:" + message.Index);
}
}
void cellularRadio_NewSMSEvent(CellularRadio sender, CellularRadio.Sms message)
{
if (message != null)
{
Debug.Print("NEW SMS");
Debug.Print("FROM: " + message.TelephoneNumber);
Debug.Print("MSG: " + message.TextMessage);
Debug.Print("WHEN: " + message.Timestamp);
Debug.Print("STATUS: " + message.Status);
Debug.Print("POS:" + message.Index);
}
}
When I start the program, I can see the following messages in the output Window of Visual Studio:
CellularRadio : Turning ON
CellularRadio : Turning module on
CellularRadio : <
RDY
>
CellularRadio : <
+CFUN: 1
+CPIN: READY
>
CellularRadio : <AT
OK
>
CellularRadio : SENT: AT
CellularRadio : SENT: AT+CMGF=1
CellularRadio : <AT+CMGF=1
OK
>
CellularRadio : SENT: AT+CSDH=0
CellularRadio : SENT: AT+CPBS="SM"
CellularRadio : <AT+CSDH=0
OK
AT+CPBS="SM"
OK
>
CellularRadio : SENT: AT+CPMS="SM"
CellularRadio : SENT: AT+CNMI=2,1,0,1,0
CellularRadio : <AT+CPMS="SM"
ERROR
AT+CNMI=2,1,0,1,0
OK
>
CellularRadio : SENT: AT+COLP=1
CellularRadio : SENT: AT+CGREG=1
CellularRadio : <AT+COLP=1
OK
AT+CGREG=1
OK
>
CellularRadio : SENT: AT+CREG=1
CellularRadio : <AT+CREG=1
OK
>
CellularRadio : <
+CREG: 0
>
CellularRadio : <
+CREG: 2
>
CellularRadio : <
+CREG: 1
+CGREG: 0
>
After that, If I try to send a SMS to the number of the SIM that I habe inserted in the module, nothing happens. I’m using an Italian telephone operator, if this matters.
Must I do some other initialization before using the module?
Thanks for the attention.