The expression read3 + " input"
performs pointer arithmetic, i.e. you either add 0 or 1 to the start adress of " input"
, so you get either " input"
or "input"
. Does the leading space disappear when pressing the button?
To correct your code you can print the number separately:
Serial.print(read3);
Serial.println(" input");
You should get rid of the rest and pub-sub code. You can add this later after having solved the problem with the button.
Also note that GPIO03 uses the same pin as RX. The docs state the following:
Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX).
So it should work after disabling Serial and after providing a pull down resistor. The resistor is needed to prevent having a floating input.
The expression read3 + " input"
performs pointer arithmetic, i.e. you either add 0 or 1 to the start adress of " input"
, so you get either " input"
or "input"
. Does the leading space disappear when pressing the button?
To correct your code you can print the number separately:
Serial.print(read3);
Serial.println(" input");
You should get rid of the rest and pub-sub code. You can add this later after having solved the problem with the button.
Also note that GPIO03 uses the same pin as RX. The docs state the following:
Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX).
So it should work after disabling Serial and after providing a pull down resistor.
The expression read3 + " input"
performs pointer arithmetic, i.e. you either add 0 or 1 to the start adress of " input"
, so you get either " input"
or "input"
. Does the leading space disappear when pressing the button?
To correct your code you can print the number separately:
Serial.print(read3);
Serial.println(" input");
You should get rid of the rest and pub-sub code. You can add this later after having solved the problem with the button.
Also note that GPIO03 uses the same pin as RX. The docs state the following:
Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX).
So it should work after disabling Serial and after providing a pull down resistor. The resistor is needed to prevent having a floating input.
- 146
- 3
The expression read3 + " input"
performs pointer arithmetic, i.e. you either add 0 or 1 to the start adress of " input"
, so you get either " input"
or "input"
. Does the leading space disappear when pressing the button?
To correct your code you can print the number separately:
Serial.print(read3);
Serial.println(" input");
You should get rid of the rest and pub-sub code. You can add this later after having solved the problem with the button.
Also note that GPIO03 uses the same pin as RX. The docs state the following:
Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX).
So it should work after disabling Serial and after providing a pull down resistor.
The expression read3 + " input"
performs pointer arithmetic, i.e. you either add 0 or 1 to the start adress of " input"
, so you get either " input"
or "input"
. Does the leading space disappear when pressing the button?
To correct your code you can print the number separately:
Serial.print(read3);
Serial.println(" input");
You should get rid of the rest and pub-sub code. You can add this later after having solved the problem with the button.
The expression read3 + " input"
performs pointer arithmetic, i.e. you either add 0 or 1 to the start adress of " input"
, so you get either " input"
or "input"
. Does the leading space disappear when pressing the button?
To correct your code you can print the number separately:
Serial.print(read3);
Serial.println(" input");
You should get rid of the rest and pub-sub code. You can add this later after having solved the problem with the button.
Also note that GPIO03 uses the same pin as RX. The docs state the following:
Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX).
So it should work after disabling Serial and after providing a pull down resistor.
The expression read3 + " input"
performs pointer arithmetic, i.e. you either add 0 or 1 to the start adress of " input"
, so you get either " input"
or "input"
. Does the leading space disappear when pressing the button?
To correct your code you can print the number separately:
Serial.print(read3);
Serial.println(" input");
You should get rid of the rest and pub-sub code. You can add this later after having solved the problem with the button.