Arduino UNO (1) Lちか

接続図

ArduinoのGNDとD13の間に赤色LEDとカーボン抵抗330Ωを接続しましょう。

Arduino IDEのインストール

Arduino IDEがまたインストールしてないの場合、普通に、Arduino IDEのインストールする。

以下URLから、ArduinoのウェブサイトからIDEをダウンロードして、インストールする

https://www.arduino.cc/en/Main/Software

CH340のドライバー

UNO互換機を使っている方は、特に何も必要ないが、今まで互換機を使ったことが無い方はWeMosのホームページからCH340のドライバー(CH341SER_MAC.ZIP)をインストールする必要がある。

以下江苏沁恒股份有限公司のHPから
CH341SER.ZIP をダウンロードして解凍し、ファイルが展開されるので setup.exe を実行。

http://www.wch.cn/download/CH341SER_ZIP.html

http://www.wch.cn/download/CH341SER_MAC_ZIP.html

Blink

動作確認のため、まずLちか(Blink)をする。

プログラムを実行してみましょう。接続した赤色LEDが1秒間隔で点滅したら成功です。

// led_blink_sample1

const int led_pin = 13;           // LED connected to digital pin 13

void setup() {
  pinMode( led_pin, OUTPUT );     // sets the digital pin as output
}

void loop() {
  digitalWrite( led_pin, HIGH );  // sets the LED on
  delay( 1000 );                  // waits for a second
  digitalWrite( led_pin, LOW );   // sets the LED off
  delay( 1000 );                  // waits for a second
}

LのLEDをBlink する様子