gsm
代码说明:
arduino的io控制输入输出#include #include #include "RC522.h"#include "DS1302.h"#include #define GSMSerial Serial1#define ID "768E4DA5"uint8_t CE_PIN = 4;uint8_t IO_PIN = 3;uint8_t SCLK_PIN = 2;char buf[50];//4 bytes Serial number of card, the 5 bytes is verfiy bytesunsigned char serNum[5];unsigned char state_pre=1;/* 创建 DS1302 对象 */DS1302 rtc(CE_PIN, IO_PIN, SCLK_PIN);void print_time() { /* 从 DS1302 获取当前时间 */ Time t = rtc.time(); snprintf(buf, sizeof(buf), "%04d-%02d-%02d %02d:%02d:%02d", t.yr, t.mon, t.date, t.hr, t.min, t.sec); /* 输出日期到串口 */ Serial.println(buf); }void setup() { Serial.begin(9600);
下载说明:请别用迅雷下载,失败请重下,重下不扣分!