2015-01-15 45 views
1

我一直在爲我的項目使用Arduino UNO微控制器。我想知道如何打開一個窗口來鍵入,例如,字符「C」來做我已經分配它做的事情。例如下面的代碼。關於arduino的命令窗口

#include <Servo.h> 
Servo servothumb; 

int command; int x =1; 

// Define thumb servo 
void setup() { 
Serial.begin (115200); 
servothumb.attach(2); // Set thumb servo to digital pin 2 
} 

void loop() { 
if(Serial.available() > 0){ 
    command = Serial.read(); 
     if (command == 'c'){} 
} 
close(); 
delay(4000); } 

void close() { 
    servothumb.write(0); 

} 
+0

'echo c> com1'? – 2015-01-15 15:39:16

+0

我認爲你在這裏更好:http://arduino.stackexchange.com/ – MrWasdennnoch 2015-01-15 15:39:52

回答

0

您需要在COM端口上打開串口終端程序。因此,例如,在Windows中,您可以使用Putty.exe,並將其配置爲在com1上運行,或者在您的Arduino所連接的任何com端口上運行。