본문 바로가기

Project/Flex Keyboard

20191103

5개의 구부림 센서의 값을 모두 받아 출력해보았다.

int temp[5][6] ={0,0,0,0,0,0};
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  int sV[5] = {analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3),analogRead(A4)};
  for (int i = 0;i<5;i++){
    temp[i][0] = temp[i][1];
    temp[i][1] = temp[i][2];
    temp[i][2] = temp[i][3];
    temp[i][3] = temp[i][4];
    temp[i][4] = sV[i];
    temp[i][5] = temp[i][0]+temp[i][1]+temp[i][2]+temp[i][3]+temp[i][4];
    Serial.print(" | "); Serial.print(i); Serial.print("sV = "); Serial.print(sV[i]);
    Serial.print(" | "); Serial.print(i); Serial.print("cS = "); Serial.print(temp[i][5]>=1000*5?100:-100);
  }
  Serial.println("");
}

'Project > Flex Keyboard' 카테고리의 다른 글

20191030  (0) 2019.10.30
20191002  (0) 2019.10.02
20180925  (0) 2019.09.26
20180920  (0) 2019.09.20
20190918  (0) 2019.09.18