小编Mar*_*ram的帖子

在Same Arduino脚本中使用Serial.print和digitalWrite

我使用的是Arduino Uno和Windows 7.我的目标是让LED指示灯闪烁,当它闪烁时,它会打印出"Blink"到串行监视器.

当我运行下面的代码时,我能够每隔2秒将"闪烁"打印到串行监视器,但是,灯仍然一直打开.当我删除该行

Serial.begin(9600);
Run Code Online (Sandbox Code Playgroud)

指示灯会闪烁,但不会打印任何内容.我运行的代码如下:

int LED3 = 0;
void setup() {
  // When I comment out the line below, the lights flash as intended, but 
  // nothing prints.  When I have the line below not commented out, 
  // printing works, but the lights are always on (ie do not blink). 

  Serial.begin(9600);  // This is the line in question.
  pinMode (LED3, OUTPUT);
}

void loop() {
  Serial.println("Blink");
  digitalWrite (LED3, HIGH);
  delay(1000);
  digitalWrite (LED3, LOW);
  delay(1000);
}
Run Code Online (Sandbox Code Playgroud)

我不清楚导致这种行为的原因,并希望解释为什么会发生这种情况以及如何避免这个问题.谢谢!

arduino arduino-uno

5
推荐指数
1
解决办法
1736
查看次数

带有多个Windows的Pygame

我需要构建一个具有多个窗口的应用程序。在其中一个窗口中,我需要能够玩一个简单的游戏,而另一个窗口则必须显示问题并获得影响游戏的用户的响应。

(1)我想使用pygame来制作游戏。有一种简单的方法可以让pygame在多个窗口中运行吗?

(2)如果没有简单的方法来解决(1),是否有一种简单的方法来使用其他一些Python GUI结构,该结构将允许我同时运行pygame和另一个窗口?

python user-interface pygame wxpython

3
推荐指数
1
解决办法
6681
查看次数

标签 统计

arduino ×1

arduino-uno ×1

pygame ×1

python ×1

user-interface ×1

wxpython ×1