Start a new topic

nodemcu 0.9

 trying to get 4 buttons to work

any help would be appreciated..


 

 ////////////////nextion loop////////////////

  if (mySerial.available() > 0)
    //mySerial.listen();
    //String mymessage = mySerial.read();
    //if (mySerial == '\n');

    if (mymessage != "_");  // if a message is received...

  char mymessage = mySerial.read();



  {
    Serial.println(mymessage); //...print it out
  }

  /*
    if ((mymessage) == '0x65 0x1 0x1 0x0 0xff 0xff 0xff')
    {
      Serial.println("Pressed1 ");
      {
         digitalWrite(16, !digitalRead(16));

        delay(500);
      }
    }


      else if ((mymessage) == '0x65 0x1 0x2 0x0 0xff 0xff 0xff')
      {
      Serial.println("Pressed2 ");
      {
      digitalWrite(4, !digitalRead(4));
      delay(500);
      }

      }



      else if ((mymessage) == '0x65 0x1 0x3 0x0 0xff 0xff 0xff')
      {
      Serial.println("Pressed3 ");
      {
      digitalWrite(0, !digitalRead(0));
      delay(500);
      }
      }




      else if ((mymessage) == '0x65 0x1 0x4 0x0 0xff 0xff 0xff')
      {
      Serial.println("Pressed4 ");
      {
      digitalWrite(2, !digitalRead(2));
      delay(500);
      }
      }


      else if (mySerial.available() > 0)
      //if (mySerial == '\n');
      //else (mySerial.flush());
      {

      delay(500);
      }




      ////////end nextion/////////

 

Login or Signup to post a comment