硬體配置
參考範例程式 "Arduino - LED"
程式
-----------------------------------------
-----------------------------------------
開啓 Tools -> Serial Monitor
結果 : 送出 "1", LED 會亮; 送出 "0", LED 會熄滅
const int buttonPin = 3;
// setup initializes serial and the button pin
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
// loop checks the button pin each time,
// and will send serial if it is pressed
void loop()
{
if (digitalRead(buttonPin) == HIGH)
Serial.write('H');
else
Serial.write('L');
delay(1000);
}
int buttonPin = 3;
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
void loop()
{
// ...
}
| Microcontroller | ATmega328 |
| Operating Voltage | 5V |
| Input Voltage (recommended) | 7-12V |
| Input Voltage (limits) | 6-20V |
| Digital I/O Pins | 14 (of which 6 provide PWM output) |
| Analog Input Pins | 6 |
| DC Current per I/O Pin | 40 mA |
| DC Current for 3.3V Pin | 50 mA |
| Flash Memory | 32 KB (ATmega328) of which 0.5 KB used by bootloader |
| SRAM | 2 KB (ATmega328) |
| EEPROM | 1 KB (ATmega328) |
| Clock Speed | 16 MHz |
| 身高 | 50cm |
|---|---|
| 體重 | 約5kg |
| 出生年月日 | 9月29日 |
| 星座 | 天秤座 |
| 愛好 | 自行車運動 |
| 夢想 | 環遊世界 |
| 座右銘 | 百折不撓 |