Scadao 发表于 2019-10-29 00:20:16

数字引脚对应编程见附件VI,截图如下——



有必要说明下PWM输出是软件实现的,非硬核PWM输出,D0~D16均可实现,内核文档说明如下:

Analog output¶analogWrite(pin, value) enables software PWM on the given pin. PWMmay be used on pins 0 to 16. Call analogWrite(pin, 0) to disable PWMon the pin. value may be in range from 0 to PWMRANGE, which isequal to 1023 by default. PWM range may be changed by callinganalogWriteRange(new_range).PWM frequency is 1kHz by default. CallanalogWriteFreq(new_frequency) to change the frequency. Valid valuesare from 100Hz up to 40000Hz.The ESP doesn’t have hardware PWM, so the implementation is by software.With one PWM output at 40KHz, the CPU is already rather loaded. The morePWM outputs used, and the higher their frequency, the closer you get tothe CPU limits, and the less CPU cycles are available for sketch execution.

Scadao 发表于 2019-10-29 10:00:11

本驱动程序针对Windows10 64位安装成功!

Scadao 发表于 2019-10-29 10:58:44

本主题帖子前面主要罗列的是WeMos D1 R1板相关信息,针对R2版,图示如下:








Scadao 发表于 2019-11-12 20:48:07

ESP8266用Arduino IDE通过贝壳物联接入天猫,可以小程序,和语音控制

ESP8266(nodeMCU固件)连接WiFi,并登录贝壳物联服务器

远程控制通讯——基于NodeMCU固件的ESP8266控制LED灯并返回控制结果

https://www.bigiot.net/Public/upload/UEditor/image/20160314/1457949970616555.png

Scadao 发表于 2019-11-12 21:04:32

使用smartconfig配置WIFI,连接物联网

#include <ESP8266WiFi.h>
WiFiClient client;
#define relay1 2
#define key 5//将dht11的data口接在8266的GPIO2上
const char *ssid = "Charlie Testing AP";
const char *password = "11111111";
const char *host = "121.42.180.30";
char flag=0;

bool autoConfig()
{
int a=0;
pinMode(key,INPUT);
if(digitalRead(key) == LOW)
flag=1;
else
flag=0;
while(!digitalRead(key));

if(flag==1)
{
return false;
}
else
{
WiFi.begin();
while (WiFi.status() != WL_CONNECTED)
{
Serial.println("AutoConfig Success");
Serial.printf("SSID:%s\r\n", WiFi.SSID().c_str());
Serial.printf("PSW:%s\r\n", WiFi.psk().c_str());
WiFi.printDiag(Serial);
delay(1000);
a++;
if(a==30)
{
a=0;
return false;
break;
}
}
if(false)
{
Serial.println("");
Serial.println("wifi line faild !");
}
else
{
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
return true;
}
}
}

void smartConfig()
{
WiFi.mode(WIFI_STA);
Serial.println("\r\nWait for Smartconfig");
WiFi.beginSmartConfig();
while (1)
{
Serial.print("Wait soft line..\r\n");
if (WiFi.smartConfigDone())
{
Serial.println("SmartConfig Success");
Serial.printf("SSID:%s\r\n", WiFi.SSID().c_str());
Serial.printf("PSW:%s\r\n", WiFi.psk().c_str());
WiFi.setAutoConnect(true); // 设置自动连接
break;
}
delay(1000);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void line_tcp()
{
Serial.println(WiFi.localIP());
const int httpPort =8181;
if (!client.connect(host, httpPort))
{
Serial.println("connection failed");
return;
}
Serial.print("connecting to ");
Serial.println(host);
client.write("{\"M\":\"checkin\",\"ID\":\"****\",\"K\":\"**********\"}\r\n");//登陆设备,修改成自己的ID和key
delay(100);
}
void setup()
{
Serial.begin(115200);
if (!autoConfig())
{
Serial.println("Start AP mode");
smartConfig();
}
line_tcp();
}

void loop()
{
char valueread;
while(client.available())
{
String line = client.readStringUntil('\r');
Serial.print(line);
int i;
for(i=0;i<=150;i++)
{
if((line=='p') &&( line=='l'))
{
digitalWrite(relay1,HIGH);
client.write("{\"M\":\"say\",\"ID\":\"ALL\",\"C\":\"LED1 is on\",\"SIGN\":\"ok\"}\r\n");
}

if((line=='s') && (line=='t'))
{
digitalWrite(relay1,LOW);
client.write("{\"M\":\"say\",\"ID\":\"ALL\",\"C\":\"LED1 is off\",\"SIGN\":\"ok\"}\r\n");
}


}
}
client.write("{\"M\":\"say\",\"ID\":\"****\",\"C\":\"123456\"}\r\n");//修改自己的ID,向设备发送信息,防止掉线
delay(6000);
}

Scadao 发表于 2019-11-12 21:25:27

贝壳物联通讯协议TCP连接测试教程

https://www.bigiot.net/Public/upload/UEditor/image/20160225/1456408631935583.png

Scadao 发表于 2019-11-15 23:13:28

Portable式安装指南

https://cdn.instructables.com/F9E/2G1D/IBQCENSY/F9E2G1DIBQCENSY.LARGE.jpg?auto=webp&frame=1&width=755&fit=bounds

https://cdn.instructables.com/FY4/03ME/IBQCENSZ/FY403MEIBQCENSZ.LARGE.jpg?auto=webp&frame=1&fit=bounds

Scadao 发表于 2019-11-16 00:51:12

本帖最后由 Scadao 于 2019-11-16 00:55 编辑

PWS的板级安装包网络连线安装不成功:因arduino.esp8266.com中的内容已移向其他地,所以人工下载win32-xtensa-lx106-elf-gb404fb9-2.tar.gzhttps://github.com/esp8266/Arduino/releases/download/2.3.0/win32-xtensa-lx106-elf-gb404fb9-2.tar.gz

最后将其拷贝到路径:..\Arduino15\staging\packages\










Scadao 发表于 2019-11-16 01:01:21


Arduino ESP8266内核安装说明文档中心



Scadao 发表于 2019-11-16 06:59:50

ESP8266其SD卡读写操作编译和DS1307时钟设置均编译成功——




页: 1 2 [3] 4
查看完整版本: ESP8266编程资源荟萃