1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

C++でRaspberry PiのLチカ

Last updated at Posted at 2024-11-10
led.cpp
#include <wiringPi.h>
#define LED 17  // 17ピンからLEDのプラス端子に印加

int main(void) {
        wiringPiSetupSys();

        pinMode(LED, OUTPUT);

        for (int i=0 ; i < 5 ; i++) {
                digitalWrite(LED, HIGH);  //オン
                delay(500);
                digitalWrite(LED, LOW);   //オフ
                delay(500);
        }
        return 0;
}

GNDとpin17に接続。
回路内のLED以外に、「抵抗」を付ける必要がある。
DSC_1733.JPG

コンパイル

g++ -o led led.cpp -lwiringPi

実行

./led
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?