change this arduino code to matlab one

조회 수: 3 (최근 30일)
john white
john white 2019년 5월 27일
Hi
is it possible to change this arduino code to the matlab code please thanks
#define outputA 6
#define outputB 7
int counter = 0;
int aState;
int aLastState;
void setup() {
pinMode (outputA, INPUT);
pinMode (outputB, INPUT);
Serial.begin(9600);
aLastState = digitalRead(outputA);
}
void loop() {
aState = digitalRead(outputA);
if (aState != aLastState) {
if (digitalRead(outputB) != aState) {
counter ++;
} else {
counter --;
}
Serial.print("Position: ");
Serial.println(counter);
}
aLastState = aState;
}

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by