写入 Sparkfun ESP8266 Thing 上的串行监视器
Writing to the serial monitor on the Sparkfun ESP8266 Thing
下面是我当前的代码:
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "836addccd2ee4f05b96f0f3ad831249e"; // ***Type in your Blynk Token
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "_Fast&Furious";// ***your wifi name
char pass[] = "Mclaren2018";// ***and password
const int MOTION_PIN = 4; // Pin connected to motion detector
WidgetLCD lcd(V1);
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(MOTION_PIN, INPUT_PULLUP);
Serial.println("SETUP");
}
void loop()
{
Blynk.run();
int proximity = digitalRead(MOTION_PIN);
if (proximity == LOW) // If the sensor's output goes low, motion is detected
{
Blynk.virtualWrite(5,1023);
lcd.clear();
lcd.print(0,0,"Motion detected");
Serial.println("Motion detected!");
}
else
{
Blynk.virtualWrite(5,0);
lcd.clear();
lcd.print(0,0,"Motion NOT detected");
Serial.println("Motion NOT detected!");
}
}
我目前正在尝试向串行控制台简单地写入一些文本。但是当我上传我的代码时,它只会将一串 k 写入控制台。产生如此奇怪的输出我做错了什么?
这是我一直关注的教程的 link:http://designinformaticslab.github.io/productdesign_tutorial/2017/01/24/motion_sensor.html
如有任何帮助,我们将不胜感激!
我觉得一切都很好,你确定串口监视器的波特率设置正确吗?我会真正快速地编写一个新程序,它只进行串行输出并使其正常工作(这简化了要解决的问题,并且如果它像串行端口速度之类的东西则更加明显),然后返回到您的更完整的程序并且它应该可以。
下面是我当前的代码:
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "836addccd2ee4f05b96f0f3ad831249e"; // ***Type in your Blynk Token
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "_Fast&Furious";// ***your wifi name
char pass[] = "Mclaren2018";// ***and password
const int MOTION_PIN = 4; // Pin connected to motion detector
WidgetLCD lcd(V1);
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(MOTION_PIN, INPUT_PULLUP);
Serial.println("SETUP");
}
void loop()
{
Blynk.run();
int proximity = digitalRead(MOTION_PIN);
if (proximity == LOW) // If the sensor's output goes low, motion is detected
{
Blynk.virtualWrite(5,1023);
lcd.clear();
lcd.print(0,0,"Motion detected");
Serial.println("Motion detected!");
}
else
{
Blynk.virtualWrite(5,0);
lcd.clear();
lcd.print(0,0,"Motion NOT detected");
Serial.println("Motion NOT detected!");
}
}
我目前正在尝试向串行控制台简单地写入一些文本。但是当我上传我的代码时,它只会将一串 k 写入控制台。产生如此奇怪的输出我做错了什么?
这是我一直关注的教程的 link:http://designinformaticslab.github.io/productdesign_tutorial/2017/01/24/motion_sensor.html
如有任何帮助,我们将不胜感激!
我觉得一切都很好,你确定串口监视器的波特率设置正确吗?我会真正快速地编写一个新程序,它只进行串行输出并使其正常工作(这简化了要解决的问题,并且如果它像串行端口速度之类的东西则更加明显),然后返回到您的更完整的程序并且它应该可以。