Skip to content

Commit

Permalink
Refactor encoder.ino
Browse files Browse the repository at this point in the history
- Commenting out troubleshooting steps for issue #12
  • Loading branch information
nopivnick committed Mar 24, 2021
1 parent ace40f6 commit f437256
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions arduino/_experiments/encoder/encoder.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ unsigned long previousTimeStamp = 0;
bool isSpinning = false;
bool isSpinningFwd = false;
bool isSpinningBkwd = false;

bool isGoTime = false;

void setup() {
Serial.begin(115200);
// Serial.flush();
// delay(10);
// timeStamp = millis();
// prevEncoderPulse = millis();
Serial.print(isSpinning);
Serial.print(" ");
Serial.println(isGoTime);
// Serial.print(isSpinning);
// Serial.print(" ");
// Serial.println(isGoTime);
}

void loop() {
Expand All @@ -40,9 +39,9 @@ void loop() {
void updateEncoder() {
encoder = ENCODER.read();
long tempEncoder = (encoder / 4); // TODO: should this just be encoder = (encoder / 4)?
// Serial.print(tempEncoder);
// Serial.print(" ");
// Serial.println(previousEncoder);
// Serial.print(tempEncoder);
// Serial.print(" ");
// Serial.println(previousEncoder);
if (tempEncoder != previousEncoder) {
Serial.println(tempEncoder);
prevEncoderPulse = timeStamp;
Expand Down Expand Up @@ -77,9 +76,9 @@ void resetEncoder() {
}

void updateState() {
Serial.print(isSpinning);
Serial.print(" ");
Serial.println(isGoTime);
// Serial.print(isSpinning);
// Serial.print(" ");
// Serial.println(isGoTime);
isGoTime = isSpinning;
if (isGoTime == true) {
Serial.println("GO!");
Expand Down

0 comments on commit f437256

Please sign in to comment.