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

シフトレジスタ (備忘)

Posted at

とても何年かぶりに、プログラムを再開。
時間ができたので、arduinoというマイコンを触ってみた。
すぐに忘れてしまうので、備忘として。

シフトレジスタを使ってLチカ。
shiftOut()関数ってカッコよし。

void setup(){
DDRD =B00011100;
PORTD=B00000000;
}

byte br[]={
  B00000000,
  B01000000,
  B00100000,
  B00010000,
  B00001000,
  B00000000,
  B00001000,
  B00010000,
  B00100000,
  B01000000,
  B00000000,
  B11111111,
};

void loop(){
for(int i=0;i<sizeof(br)/sizeof(byte);i++){
shiftOut(4,2,LSBFIRST,br[i]);
PORTD=B00001000;
PORTD=B00000000;
delay(100);
}
}

D2pin : SRCLK
D3pin : RCLK
D4pin : SER

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?