Software Code
Download the example; copy the code stick onto the Aruino IDE and
then upload it.
#
include
<Arduino.h>
#
include
<U8x8lib.h>
#
include
"DHT.h"
#
define
DHTPIN 0
// what pin we're connected to
// Uncomment whatever type you're using!
#
define
DHTTYPE DHT11
// DHT 11
// #define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT
dht
(DHTPIN, DHTTYPE);
U8X8_SSD1306_128X64_NONAME_HW_I2C
u8x8
(
/* reset=*/
U8X8_PIN_NONE);
// U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /*
reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display
static
char
recv_buf[
512
];
static
bool
is_exist =
false
;
static
bool
is_join =
false
;
static
int
led =
0
;
static
int
at_send_check_response
(
char
*p_ack,
int
timeout_ms,
char
*p_cmd, ...)
{
int
ch;
int
num =
0
;
int
index =
0
;
int
startMillis =
0
;
va_list
args;
memset
(recv_buf,
0
,
sizeof
(recv_buf));
va_start(args, p_cmd);
Serial1.
printf
(p_cmd, args);
Serial.
printf
(p_cmd, args);
va_end(args);
delay(
200
);
startMillis = millis();
if
(p_ack ==
NULL
)
{
return
0
;
}
do
{
while
(Serial1.available() >
0
)
{
ch = Serial1.read();
recv_buf[index++] = ch;
Serial.print((
char
)ch);