SMS WITH BUTTON

hi to all, I have begun today to use wireless cpu q2686, as first step I would want to be able to send a sms when I press a push-button, I have tried to read the several examples, but I have not resolved. someone you can help me? thanks

What examples did you “try” to read?

In what way(s) are you still “not resolved” ?

It is difficult to help you if you don’t explain exactly what it is, exactly, that you require help with! :unamused:

You need to give a clear & complete description of:

  • What you tried
  • What you thought should happen
  • What actually happened
  • What thoughts and/or experiments you have made in an attempt to explain the difference!

ok. sorry for being be little clear. the examples that I have seen are: sms_auto, telemetry I do not understand like setting up the keypad like input. I want that pressing a button of the keypad it sends a sms. I hope of being be clearer. sorry for my English :confused: …thanks

If you just want one button, it’d probably be simpler to just use a GPIO…

yes, I would want to try with a single button, I have found this example, but M2M does not compile it!

#include “adl_global.h”
const u16 wm_apmCustomStackSize = 1024;
const adl_ioConfig_t MyGpioConfig[1] = {ADL_IO_Q2686_GPIO_44,0,ADL_IO_INPUT};
u8 SMSHandle;
s32 GpioEventHandle;
u8 k;

void GpioEventHandler ( s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void * Param )
{
switch (Event)
{
case ADL_IO_EVENT_INPUT_CHANGED:
{
if (k==0) // to filter the first ADL_IO_EVENT_INPUT_CHANGED received at astart up
{
k++;
}

        else
        {
            TRACE((1,"ADL_IO_EVENT_CHANGED"));
            TRACE((1,"state = %d", (((adl_ioRead_t *)Param) [0].eState)));
            if ((((adl_ioRead_t *)Param) [0].eState)) // check the state of the GPIO
                {
                    TRACE((1,"GPIO_44 is high"));
                    adl_smsSend( SMSHandle, "+333333333", "GPIO_44 switches to high", ADL_SMS_MODE_TEXT );    // Change the phone number please!
                }
            else
            {
                TRACE((1,"GPIO_44 is low"));
                adl_smsSend( SMSHandle, "+3333333333", "GPIO_44 switches to low", ADL_SMS_MODE_TEXT );
            }
        }
        break;
    }
}

}

void SmsCtrlHandler ( u8 Event, u16 Nb )
{
TRACE((1,“Evento = %d”, Event));
}
bool SmsHandler ( ascii * SmsTel, ascii * SmsTimeOrLength, ascii * SmsText )
{
return FALSE;
}
void SimHandleravnet(u8 Event)
{
TRACE((1,“SimHandleravnet = %d”, Event));
switch (Event)
{
case ADL_SIM_EVENT_FULL_INIT:
TRACE((1,“ADL_SIM_EVENT_FULL_INIT”));
SMSHandle = adl_smsSubscribe( SmsHandler, SmsCtrlHandler, ADL_SMS_MODE_TEXT );

    GpioEventHandle = adl_ioEventSubscribe ( GpioEventHandler );
    adl_ioSubscribe ( 1, MyGpioConfig, ADL_TMR_TYPE_100MS, 1, GpioEventHandle );
    break;
}

}
void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, “Embedded Application : Main” ));

adl_simSubscribe ( SimHandleravnet, NULL );

}

OK…i resolved with

#include “adl_global.h”
#define GPIO_OUTPUT_PIN 22
#define GPIO_INPUT_PIN 4
// GPIO service handle
static s32 GPIOHandle_OUT;
static s32 GPIOHandle_IN;
s32 ReadValue;
adl_ioDefs_t GpioConfig_OUT = ADL_IO_GPIO | GPIO_OUTPUT_PIN | ADL_IO_DIR_OUT;
adl_ioDefs_t GpioConfig_IN = ADL_IO_GPIO | GPIO_INPUT_PIN | ADL_IO_DIR_IN;
const u16 wm_apmCustomStackSize = 1024*3;
s32 GpioEventHandle;
void GpioEventHandler ( s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void * Param ){
s32 ReadValue_IN;
s32 ReadValue_OUT;
// Check event
switch ( Event ){
case ADL_IO_EVENT_INPUT_CHANGED :
ReadValue_IN = adl_ioReadSingle (GPIOHandle_IN, &GpioConfig_IN);
if (ReadValue_IN == 0){
adl_ioWriteSingle ( GPIOHandle_OUT, &GpioConfig_OUT, TRUE );
ReadValue = adl_ioReadSingle (GPIOHandle_IN, &GpioConfig_IN);
}
adl_ioWriteSingle ( GPIOHandle_OUT, &GpioConfig_OUT, FALSE );
}
}
void adl_main ( adl_InitType_e InitType ){
adl_ioWriteSingle ( GPIOHandle_OUT, &GpioConfig_OUT, FALSE );
adl_ioWriteSingle ( GPIOHandle_IN, &GpioConfig_IN, TRUE );
GpioEventHandle = adl_ioEventSubscribe (GpioEventHandler);
GPIOHandle_OUT = adl_ioSubscribe ( 1, &GpioConfig_OUT, 0, 0, 0 );
GPIOHandle_IN = adl_ioSubscribe ( 1, &GpioConfig_IN, 1, 1, GpioEventHandle );
}

thanks…