uint8_t sim900_send_sms_to_phone_book(const char * sms_book[],const uint8_t isBOOKPGM,char * const msg,const uint8_t isMSGPGM) { const size_t n = sizeof(sms_book)/sizeof(char *); uint8_t e = 0; for(size_t i=0;i<n;++i) { if(sim900_send_sms(msg,isMSGPGM,sms_book[i],isBOOKPGM)!=0) e=-1; } return e; }
int main(void){ //DDRA = 0xff; //ENCODER_DDR &= ~(_BV(ENCODER_PIN)); //ENCODER_PORT |= (_BV(ENCODER_PIN)); sim900_init(); //ntp_decode_UTC(3580318410); sim900_data_connect(); while(1) {} if (sim900_poweron()) { for (uint8_t i=0; i < 20; i++) { sim900_cmd_wait_response("AT+CCALR?"); if (sim900_test_last_response("1")) { sim900_send_sms(send_to_number, "How are you today?"); break; } _delay_ms(500); } /* if (sim900_cmd_wait_response("AT+CCALR?")) { if (sim900_test_last_response("1")) { sim900_send_sms(send_to_number, "How are you today?"); } }*/ } sim900_cmd_wait_response("AT+CPOWD=1"); while(1) { } while(1) { _delay_ms(2000); //read_dials(); } }