Skip to main content
Described edit rather than showing resultant code.
Source Link
NVRAM
  • 161
  • 4

Just at a glance:

Your loop consumes the byte and stores it in serialRead, so there is probably no available data at the outer if, so it is never entered.

Try deleting this? line:

void loop() {
  ///serialRead = Serial.read();
  if (Serial.available() > 0) {
    val = Serial.read();

    if (val > '0' && val <= '9') {
      Serial.println(val);
      val = val - '0';
      Serial.println(val);

      if (val == 3)
      {
        //strip.setBrightness(100);
        colorWipe(strip.Color(127, 127, 127), 50);
        colorWipe(strip.Color(0, 0, 0), 50);        
      }
    }
  }
}

Just at a glance:

Your loop consumes the byte and stores it in serialRead, so there is probably no available data at the outer if, so it is never entered.

Try this?

void loop() {
  ///serialRead = Serial.read();
  if (Serial.available() > 0) {
    val = Serial.read();

    if (val > '0' && val <= '9') {
      Serial.println(val);
      val = val - '0';
      Serial.println(val);

      if (val == 3)
      {
        //strip.setBrightness(100);
        colorWipe(strip.Color(127, 127, 127), 50);
        colorWipe(strip.Color(0, 0, 0), 50);        
      }
    }
  }
}

Just at a glance:

Your loop consumes the byte and stores it in serialRead, so there is probably no available data at the outer if, so it is never entered.

Try deleting this line:

serialRead = Serial.read();
Source Link
NVRAM
  • 161
  • 4

Just at a glance:

Your loop consumes the byte and stores it in serialRead, so there is probably no available data at the outer if, so it is never entered.

Try this?

void loop() {
  ///serialRead = Serial.read();
  if (Serial.available() > 0) {
    val = Serial.read();

    if (val > '0' && val <= '9') {
      Serial.println(val);
      val = val - '0';
      Serial.println(val);

      if (val == 3)
      {
        //strip.setBrightness(100);
        colorWipe(strip.Color(127, 127, 127), 50);
        colorWipe(strip.Color(0, 0, 0), 50);        
      }
    }
  }
}