3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

初めてのArduino(Lチカまで)

Last updated at Posted at 2017-11-18

必要なもの

  • Arduino本体
  • USBケーブル(Arduino側がType-Bなので注意)
  • Arduino IDE
    • 2017/11/18日現在、バージョンは1.8.5

環境

項目
OS MacOS Siera
Arduino Uno Rev3

Arduino IDEのインストール

ダウンロードページで以下の箇所から自分の環境に合ったインストーラをダウンロードしてインストールする。

スクリーンショット 2017-11-18 10.23.28.png

ArduinoとPCの接続

このような形で接続する。

arduino.jpg

Arduino IDEのセットアップ

スクリーンショット 2017-11-18 10.21.30.png

ツール => シリアルポートからArduinoが接続されているポートを選択。

コード記述

1秒ごとに13番ピンの電圧レベルを切り替える。

.c
int led = 13;

void setup() {
  // put your setup code here, to run once:
  pinMode(led, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(led, HIGH);
  delay(1000);
  digitalWrite(led, LOW);
  delay(1000);
}

コード検証 + 書き込み

スクリーンショット 2017-11-18 10.33.33.png

左上のチェックマークをクリックするとコードの検証を行うことができ、
右矢印のマークをクリックするとArduinoに書き込みを行うことができる。

LEDを13番に接続

一秒ごとにLEDが点滅するようになる。
なお、LEDには向きがあるので注意。
長い足の方を13番ピンに差す。

led.jpg

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?