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?

More than 1 year has passed since last update.

74HC165AP

Posted at

:taco:配線:taco:

74HC165.jpg
https://rephtone.com/electronics/arduino-74hc165/ 参照
CLK INH : GND
SER : GND
QH : 4
SH/LD : 2
CLK : 3

プログラム

/*
 * 74HC165
 * SH/LD 2
 * CLK 3
 * QH 4
 */

int const SL = 2;
int const CLK = 3;
int const SER = 4;

int array[8] = {0,0,0,0,0,0,0,0,};

void setup() {
  pinMode(CLK, OUTPUT);
  pinMode(SL, OUTPUT);
  pinMode(SER, INPUT);

  digitalWrite(SL, HIGH);
  digitalWrite(CLK, LOW);

  Serial.begin(9600);
}

void loop() {
  digitalWrite(SL, LOW);
  digitalWrite(SL, HIGH);
  for (int i=0; i<8; i++){
    array[i] = (digitalRead(SER));
    digitalWrite(CLK, HIGH);
    digitalWrite(CLK, LOW);
  }
  for (int i=0; i<8; i++){
    if (array[i] == 0){
      Serial.print("0, ");
    }
    if (array[i] == 1){
      Serial.print("1, ");
    }
  }
  Serial.println();
  
}
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?