资源简介
SIM800C模块参考例程,Arduino、STC12、STC15、STC89、STM32都有例程,亲测可用,仅供参考。
代码片段和文件信息
/*
GSM.cpp - library for the GSM Playground - GSM Shield for Arduino
Released under the Creative Commons Attribution-Share Alike 3.0 License
http://www.creativecommons.org/licenses/by-sa/3.0/
www.hwkitchen.com
*/
#include “WProgram.h“
#include “NewSoftSerial.h“
#include “GSM_Shield.h“
extern “C“ {
#include
}
NewSoftSerial mySerial(4 5); //rx tx
#ifdef DEBUG_LED_ENABLED
int DEBUG_LED = 25; // LED connected to digital pin 25
void GSM::blinkDebugLED (byte num_of_blink)
{
byte i;
pinMode(DEBUG_LED OUTPUT); // sets the digital pin as output
for (i = 0; i < num_of_blink; i++) {
digitalWrite(DEBUG_LED HIGH); // sets the LED on
delay(50);
digitalWrite(DEBUG_LED LOW); // sets the LED off
delay(500);
}
}
#endif
#ifdef DEBUG_PRINT
/**********************************************************
Two methods print out debug information to the standard output
- it means to the serial line.
First method prints string.
Second method prints integer numbers.
Note:
=====
The serial line is connected to the GSM module and is
used for sending AT commands. There is used “trick“ that GSM
module accepts not valid AT command strings because it doesn‘t
understand them and still waits for some valid AT command.
So after all debug strings are sent we send just AT as
a valid AT command and GSM module responds by OK. So previous
debug strings are overwritten and GSM module is not influenced
by these debug texts
string_to_print: pointer to the string to be print out
last_debug_print: 0 - this is not last debug info we will
continue with sending... so don‘t send
AT(see explanation above)
1 - we are finished with sending debug info
for this time and finished AT
will be sent(see explanation above)
**********************************************************/
void GSM::DebugPrint(const char *string_to_print byte last_debug_print)
{
if (last_debug_print) {
Serial.println(string_to_print);
SendATCmdWaitResp(“AT“ 500 50 “OK“ 1);
}
else Serial.print(string_to_print);
}
void GSM::DebugPrint(int number_to_print byte last_debug_print)
{
Serial.println(number_to_print);
if (last_debug_print) {
SendATCmdWaitResp(“AT“ 500 50 “OK“ 1);
}
}
#endif
/**********************************************************
Method returns GSM library version
return val: 100 means library version 1.00
101 means library version 1.01
**********************************************************/
int GSM::LibVer(void)
{
return (GSM_LIB_VERSION);
}
/**********************************************************
Constructor definition
***********************************************************/
GSM::GSM(void)
{
// set some GSM pins as inputs some
- 上一篇:Open Source Fuzzing Tools
- 下一篇:H∞控制理论及应用
相关资源
- 140个LabView经典例程.zip
- ccs5.5 例程
- BH1750FVI STM32F103 HAL库 硬件IIC例程
- GNSS/INS组合导航例程
- okC8T6--FLASH模拟EEPROM.zip
- SX1276例程
- stm32f1+sim800c全部代码GPRS短信电话等
- 野火STM32F10X例程源码_超声波.rar
- IQmath官方资料,工程文件及中文手册
- DSP281x官方头文件及例程
- OLED驱动库、例程、取字软件与资料
- BASCOM-AVR的例程
- 多重网格法 刘超群 详细例程
- DM642图像板完整工程原理图、PCB及对应
- 周立功 SmartCortex M3-1700 配套例程及工
- stm32通过esp8266把温湿度和gps地图上传
- 用STM32实现sim800c透传
- 数据结构-清华大学课程ppt带部分例程
- dwm1000官方例程
- 51单片机100个例程加仿真图
- EC20_发英文短信例程.zip
- 佳博打印机SDK包含自己用Labview写的例
- lpc1114 - 11xx 比较全的例程源代码
- 台达PLC-DVP12SE 11T网络通信例程及函数
- stm32f407+mbed+lwip+lan8720 例程
- STM32F4-SIM900A模块GPRS功能使用精简例程
- 用于DSP28335的编程例程 主要是用于有
- 83个PIC877A例程
- 中景园电子0.96OLED显示屏_STM32系列_S
- LPC2138例程,适合初学
评论
共有 条评论