关于arduino uno 0, 1, 13管脚无法使用的问题

1、关于0和1管脚 io正常使用的问题

 0和1管脚主要是用于串口通信的,已经被板子本身用了,如果我们去用的话,会导致usb无法往板子下载程序。会报类似以下错误:

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

 

2、关于13管脚无法用像其它io正常使用的问题,参见以下说明,主要还是被板子是bootloader使用了。

参见:https://arduino.stackexchange.com/questions/1448/whats-the-deal-with-unos-pin-13-led

 

The LED on pin 13 is used by the optiboot loader (the one used on UNO):

  • at Arduino boot time (the LED blinks a few times)
  • when uploading a sketch to Arduino

I haven't checked other bootloaders, they may provide the same behavior as the optiboot.

For optiboot, there are optional defines (at compile time) to modify this behavior:

  • LED_START_FLASHES defines the number of flashes of pin 13 LED at boot time (can be set to 0)
  • LED_DATA_FLASH will use pin 13 LED during sketch upload if defined at compile-time

These defines are explained in hardware/arduino/bootloaders/optiboot/optiboot.c from within your Arduino IDE install directory.

If you want to change these, you will have to recompile the optiboot loader first and then burn it to your Arduino through an ISP programmer.

I guess one other reason for the LED on pin 13 was to simplify the demonstration of the "Hello World" sketch for Arduino, namely the Blink sketch, without the need for any extra component.

你可能感兴趣的:(arduino)