掌控板初见面
本帖最后由 teu 于 2020-5-17 16:39 编辑先来几张图片(感觉配上扩展板好丑)
给大家一个掌控小闹钟的程序;(用mind+(sb3我无法上传))
#include <MPython.h>
#include <DFRobot_Iot.h>
#include <MPython_NtpTime.h>
#include <mPython_Weather.h>
// 创建对象
DFRobot_Iot myIot;
MPython_NtpTime ntptime;
mPython_Weather myWeather;
// 主程序开始
void setup() {
mPython.begin();
myIot.wifiConnect("", "");
while (!myIot.wifiStatus()) {yield();}
ntptime.setNtpTime(ntptime.UTCEast8_t, "ntp.ntsc.ac.cn");
myWeather.init("server.mindplus.top", "31982666", "E6MtBcxQ");
buzz.redirect(P0);
}
void loop() {
if ((((((ntptime.localTime(ntptime.Year)==2020) && (ntptime.localTime(ntptime.Month)==5)) && (ntptime.localTime(ntptime.Hour)==7)) && (ntptime.localTime(ntptime.Minute)==15)) && (ntptime.localTime(ntptime.Second)==0))) {
buzz.play(DADADADUM, Once);
display.setCursorLine(1);
display.printLine((String("深圳今天的天气") + String(myWeather.getWeather("weather", "101280601"))));
display.setCursorLine(2);
display.printLine((String("深圳今天的最高气温") + String(myWeather.getWeather("temperaturHigh", "101280601"))));
display.setCursorLine(3);
display.printLine((String("深圳今天的最低气温") + String(myWeather.getWeather("temperaturLow", "101280601"))));
display.setCursorLine(4);
display.printLine((String((String(ntptime.localTime(ntptime.Month)) + String("月"))) + String((String(ntptime.localTime(ntptime.Date)) + String("日")))));
}
}
新人,鼓励一个,多发帖子,多参加社区活动啊{:6_203:} 代码最终的运行结果 加油
页:
[1]