所以我所要做的就是打開一個功能來打開和關閉將被調入主顯示屏的LED。 LED亮起,但不打開和關閉。我的代碼有什麼問題?LED保持點亮。不會打開和關閉
我使用ATMEGA328P板和愛特梅爾Studio的6.2
#define F_CPU 16000000UL // 16MHz clock from the debug processor
#include <avr/io.h>
#include <util/delay.h>
dot();
int main()
{
DDRB |= (1<<DDB5);
while(1)
{
dot();
}
}
int dot()
{
PORTB |= (1<<PORTB5); // Set port bit B5 to 1 to turn on the LED
_delay_ms(200); // delay 200mS
PORTB |= (0<<PORTB5); // Set port bit B5 to 0 to turn on the LED
_delay_ms(200); // delay 200mS
}
非常感謝。我會閱讀更多關於位和操作符的信息。 –