这里我评论了pinmode部分:
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(10, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
我的测试中的等于:
Private Type CHOOSECOLORSTRUCT
lStructSize As Long
hwndOwner As Long
hInstance As Long
rgbResult As Long
lpCustColors As Long
flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Declare Function ChooseColor Lib "comdlg32.dll" _
Alias "ChooseColorA" _
(lpcc As CHOOSECOLORSTRUCT) As Long
似乎只是LED闪烁微弱。 谢谢你的时间。
答案 0 :(得分:1)
来自documentation for digitalWrite():
将高或低值写入数字引脚。
如果引脚已配置为带有pinMode()的OUTPUT,则为 电压将设置为相应的值:5V(3.3V时3.3V 电路板)用于高电平,0V(接地)用于低电平。
如果引脚配置为INPUT,则digitalWrite()将启用 (HIGH)或禁用(LOW)输入引脚上的内部上拉。它是 建议将pinMode()设置为INPUT_PULLUP以启用 内部上拉电阻。有关更多信息,请参阅数字引脚教程 信息。
如果没有将pinMode()设置为OUTPUT,并将LED连接到a 引脚,当调用digitalWrite(HIGH)时,LED可能显得暗淡。没有 显式设置pinMode(),digitalWrite()将启用 内部上拉电阻,其作用类似于大电流限制 电阻器。