用于在指定时间(倒计时器)后关闭或重新启动基于 Windows 的计算机的脚本。
#if ARDUINO > 10605
#include <Keyboard.h>
#endif
void typeKey(uint8_t key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
/* Init function */
void setup()
{
// Begining the Keyboard stream
Keyboard.begin();
//Wait 500ms
delay(500);
delay(3000);
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
Keyboard.releaseAll();
delay(200);
Keyboard.print("cmd");
typeKey(KEY_RETURN);
delay(200);
Keyboard.print("shutdown -s -f -t 3600 -c \"Some text\"");
// 3600 - 1 Hour, for cancel use command shutdown -a
// for reboot change -s on -r
delay(200);
typeKey(KEY_RETURN);
Keyboard.print("exit");
typeKey(KEY_RETURN);
delay(3000);
// Ending stream
Keyboard.end();
}
/* Unused endless loop */
void loop() {}
暂时没有评论