LoginSignup
0
0

More than 1 year has passed since last update.

Arduino スターターキットでセンサーを作る #1 導入&LED点滅

Last updated at Posted at 2021-06-07

Ardino スターターキットでセンサーを作る #1 導入&LED点滅

環境

  • Mac
  • ELEGOO UNO キット レベルアップ  チュートリアル付 uno mega2560 r3 nanoと互換 Arduino用

開封 & インストール

IMG_0556.jpg

付属のCD-ROMを参考にインストールを行う

Arduino統合開発環境(IDE)は、Arduinoプラットフォームのソフトウェア側です。
Arduinoをプログラミングするために使用するArduinoソフトウェアは、Windows、Mac、Linuxで使用できます。
インストールプロセスは3つのプラットフォームすべてで異なります。
残念ながら、ソフトウェアをインストールするには一定の作業が必要です。

下記、リンクからダウンロード
https://www.arduino.cc/en/Main/Software

アプリを実行するとスケッチが表示される
スクリーンショット 2021-06-07 7.53.04.png

ArduinoとPCをUSB接続する

IMG_0558.JPG

点滅時間を変更する

[ファイル]->[スケッチ例]->[01.Basics]->[Blink] を参考に点滅させる
blink:点滅させる
delayの時間を変えると点滅時間の変更が確認できる
変更を読み込ませるためには、「マイコンボードに書き込む」を選択
処理を終了させるためには、USB接続を抜く

bulink.h
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

LEDを点滅させる

blink.h
const int LED_PIN = 13; // デジタルpin13

void setup() {
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_PIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(2000);                       // wait for a second
  digitalWrite(LED_PIN, LOW);    // turn the LED off by making the voltage LOW
  delay(500);                       // wait for a second
}

IMG_0559.jpg

  • 長い方:プラス
  • 短い方:マイナス

直接差し込んでみる

  • 13番にプラス
  • GNDにマイナス

IMG_0560.JPG
光った!!
直接刺すのは、電流が多く流れてLEDに負荷がかかって、
長時間経つとLEDが壊れてしまうので、確認用まで

参考

0
0
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
0
0