text:
Debugging different serial receive / send behavior between Uno & Mega
I have a simple text parser (as a component of a larger project) coded up and seemingly working correctly. It parses a key-value delimited command like the following: <key1=value1;key2=value2;key3=value3>.
At present, the functionality is very silly just to test it out: when the Arduino finds a key named "text", it composes a response of a similar form, but just with one key "text_return" and the same value, and sends it back via serial. That is, when the command <key1=value1;text=123;key3=value3> is sent, I expect a response from the Arduino of <text_return=123>.
I then am connecting the board to my laptop via USB, and testing it out, both with the Serial Monitor in Arduino's IDE, and with a simple program coded in python.
So here's the confusing part:

Serial Monitor with Uno: works
Python with Uno: works
Serial Monitor with Mega: works
Python with Mega: does NOT work

Specifically, by "does not work", I mean that the Mega seems to receive the serial input from the program, but does not issue a response.
Here's the terminal output from test #2 as displayed by the python program, showing the command-response I'd expect (I parsed the received command into a dict):
SENT: <text=1953>
SENT: <text=1954>
SENT: <text=1954>
SENT: <text=1954>
SENT: <text=1954>
SENT: <text=1954>
SENT: <text=1954>
SENT: <text=1954>
RECD: {'text_return': 1954}
SENT: <text=1954>
RECD: {'text_return': 1954}
SENT: <text=1954>
RECD: {'text_return': 1954}
SENT: <text=1954>
RECD: {'text_return': 1954}

And here's the terminal output from the non-working test#4 - i.e.: no response.
SENT: <text=2001>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2002>
SENT: <text=2003>
SENT: <text=2003>
SENT: <text=2003>
SENT: <text=2003>
SENT: <text=2003>
SENT: <text=2003>
SENT: <text=2003>
SENT: <text=2003>

In all cases, I'm using 9600 Baud; the only change between the two tests is that I select the Uno vs. Mega / Mega 2560 board in the Arduino IDE.
The Mega board is an Elegoo Mega2560 R3. The code may be extraneous, but to help:
Opening the port to the arduino from python
def FindArduino(baud=9600, timeout=0):
  initial_time = time.time()
  arduino_found = False
  attempted = False
  while not attempted or time.time() - initial_time < timeout and not arduino_found:
    attempted = True
    ports = serial.tools.list_ports.comports(include_links=False)
    for port in ports:
      manufacturer = port.manufacturer
      if manufacturer and 'arduino' in manufacturer.lower():
        arduino_port = port
        arduino_found = True

  if arduino_found:
    try:
      arduino = serial.Serial(arduino_port.device, baud, timeout=0)
      arduino.reset_input_buffer()
      arduino.reset_output_buffer()
    except serial.SerialException:
      arduino_found = False

  if arduino_found:
    return arduino
  else:
    return None

Sending the serial in python, to Arduino
  cmd = '<text=%d>' % (time.time() - 1586218411)
  print('SENT: %s' %cmd)
  cmd = bytes(cmd, 'ascii')
  arduino.write(cmd)
  time.sleep(.1)

Receiving the serial in python, from Arduino
  cmds = []

  if (arduino.in_waiting>0):
    buffer += arduino.read(arduino.in_waiting).decode('ascii')
    while COMMAND_END_CHAR in buffer:
      end_char_pos = buffer.find(COMMAND_END_CHAR)
      potential_command = buffer[:end_char_pos]
      if COMMAND_START_CHAR in potential_command:
        cmds.append(potential_command[potential_command.find(COMMAND_START_CHAR)+1:])
      buffer = buffer[end_char_pos+1:]

  return (buffer, cmds)

And the full code on the Arduino itself
// command indicators
char START_MARKER = '<';
char END_MARKER = '>';

const int MAX_KEY_VALUE_PAIRS = 3;  // maximum number of key-value pairs in message
const int MAX_ELEMENT_CHARS = 30;  // the maximum number of characters (+1 for terminator) in a key or a value

// message format: <key1=value1;key2=value2;key3=value3>
const int MAX_MESSAGE_CHARS = (MAX_KEY_VALUE_PAIRS * (MAX_ELEMENT_CHARS + 1)) * 2 + (MAX_KEY_VALUE_PAIRS - 1) + 2;  // maximum message size

char received_chars[MAX_MESSAGE_CHARS];
bool new_data = false;
char written_chars[MAX_MESSAGE_CHARS];

char *text =  {'\0'};

void ParseData(char *str) {
  // This picks off the ;-delimited key-value pairs and assigns them to a multi-dim array
  char * pch;
  int pairs_count = 0;
  char config[MAX_KEY_VALUE_PAIRS][2][MAX_ELEMENT_CHARS];

  pch = strtok(str, "=");

  while (pch != NULL)
  {
    strcpy(config[pairs_count][0], pch);
    pch = strtok(NULL, ";");
    if (pch == NULL) break;

    strcpy(config[pairs_count][1], pch);
    pairs_count++;
    pch = strtok(NULL, "=");
    if (pch == NULL) break;
  }

  for(int i=0;i<pairs_count;i++) {
    if (strcmp(config[i][0], "text")==0)
      strcpy(text, config[i][1]);
    WriteSerial();
  }
}

void ReadSerial(){
  // After calling ReceiveText to empty the buffer, if a complete command has been found,
  // parse that command.
  new_data = ReceiveText();
  if (new_data == true) {
    char temp_chars[MAX_MESSAGE_CHARS];  // temporary array for use when parsing
    strcpy(temp_chars, received_chars);
    received_chars[0] = '\0';
    ParseData(temp_chars);
  }
}

void WriteSerial(){
  sprintf(written_chars, "<text_return=%s>\n", text);
  Serial.write(written_chars);
  written_chars[0] = '\0';
}

boolean ReceiveText() {
  // This dumps the characters on the buffer so far received_chars, searching for an END_MARKER
  // along the way; if it finds one, it goes back to find a START_MARKER; if that is also found,
  // the string within is the ;-delimited set of key value pairs
  static boolean recv_in_progress = false;
  static byte ndx = 0;
  char rc;

  boolean new_data = false;
  while (Serial.available() > 0 && new_data == false) {
    rc = Serial.read();

    if (recv_in_progress == true) {
      if (rc != END_MARKER) {
        received_chars[ndx] = rc;
        ndx++;
        if (ndx >= MAX_MESSAGE_CHARS) {
          ndx = MAX_MESSAGE_CHARS - 1;
        }
      } else {
        received_chars[ndx] = '\0'; // terminate the string
        recv_in_progress = false;
        ndx = 0;
        new_data = true;
      }
    } else if (rc == START_MARKER) {
        recv_in_progress = true;
    }
  }
  return new_data;
}

void setup() {
  Serial.begin(9600);
  text = (char*)malloc(25);

  received_chars[0] = '\0';

}

void loop() {
  ReadSerial();
}

UPDATE
Using the suggested libraries, I updated the code. The comms in both directions for simple test data are working, though I can't seem to convert the packet received by the Arduino into a string correctly.  Here is the output I see from my python terminal; I'd expect to receive back the first character of what was sent (i.e.: the "0", then "1"), rather than just the initialized value of "S".
SENT: 0.20
RCVD: S
SENT: 0.41
RCVD: S
SENT: 0.61
RCVD: S
SENT: 0.82
RCVD: S
SENT: 1.02
RCVD: S
SENT: 1.23
RCVD: S
SENT: 1.43
RCVD: S
SENT: 1.64
RCVD: S

Python code
import time
from pySerialTransfer import pySerialTransfer as txfer

if __name__ == '__main__':
  try:
    link = txfer.SerialTransfer('/dev/cu.usbmodem14201')

    link.open()
    time.sleep(2) # allow some time for the Arduino to completely reset
    base = time.time()

    while True:
      time.sleep(0.2)
      s = '%.2f' % (time.time() - base)
      l = len(s)
      for i in range(l):
        link.txBuff[i] = s[i]

      link.send(l)

      while not link.available():
        if link.status < 0:
          print('ERROR: {}'.format(link.status))

      response = ''
      for index in range(link.bytesRead):
        response += chr(link.rxBuff[index])

      print('SENT: %s' % s)
      print('RCVD: %s' % response)

  except KeyboardInterrupt:
    link.close()

Arduino code
#include "SerialTransfer.h"

char str[100];

SerialTransfer myTransfer;
int LED = 13;

void blinkLED(int n)
{
  for (int i = 0; i < n; i++) {
    digitalWrite(LED, HIGH);
    delay(150);
    digitalWrite(LED, LOW);
    delay(150);
  }
}

void setup()
{
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);
  str[0] = 'S';
  str[1] = '\n';
  Serial.begin(115200);
  myTransfer.begin(Serial);
}

void loop()
{
  blinkLED(2);
  delay(500);

  // send bytes
  myTransfer.txBuff[0] = str[0];
  myTransfer.sendData(1);
  if(myTransfer.available())
  {
    blinkLED(60);

    // receive bytes
    byte bytes_to_read = myTransfer.bytesRead;
    for(byte i = 0; i < bytes_to_read; i++)
      strncpy(str + i, myTransfer.rxBuff[i], 1);

  }
  else if(myTransfer.status < 0)
  {
    Serial.print("ERROR: ");

    if(myTransfer.status == -1)
      Serial.println(F("CRC_ERROR"));
    else if(myTransfer.status == -2)
      Serial.println(F("PAYLOAD_ERROR"));
    else if(myTransfer.status == -3)
      Serial.println(F("STOP_BYTE_ERROR"));
  }
}

Thank you!

start debugging by replacing ReadSerial(); in loop() with WriteSerial() to send pre-determined data .... include a 5 second pause

Good suggestion - just tried that delay(1000); WriteSerial(); in the loop. Beginning to pinpoint - I'm not throttling my python (as I'm simulating the data pipeline at present, going much faster than it will with real data). So my test message gets sent to Mega ~20x per second. Perhaps that's keeping it from replying, or overwriting memory where it would reply? When I throttle the python code to once every 1s, the problem disappears. Throttling wasn't necessary for the Uno. I'lll experiment to find level of throttling necessary, but any thoughts as to why throttling needed, or diff from Uno?

It would be easier if you used Arduino <--> Python compatible libraries to ensure the communication between the two is robust and reliable. An example of such libraries would be pySerialTransfer and SerialTransfer.h.
pySerialTransfer is pip-installable and cross-platform compatible. SerialTransfer.h runs on the Arduino platform and can be installed through the Arduino IDE's Libraries Manager.
Both of these libraries have highly efficient and robust packetizing/parsing algorithms with easy to use APIs.
Example Python Script:
from time import sleep
from pySerialTransfer import pySerialTransfer as txfer

if __name__ == '__main__':
    try:
        link = txfer.SerialTransfer('COM17')

        link.open()
        sleep(2) # allow some time for the Arduino to completely reset

        while True:
            link.txBuff[0] = 'h'
            link.txBuff[1] = 'i'
            link.txBuff[2] = '\n'

            link.send(3)

            while not link.available():
                if link.status < 0:
                    print('ERROR: {}'.format(link.status))

            print('Response received:')

            response = ''
            for index in range(link.bytesRead):
                response += chr(link.rxBuff[index])

            print(response)

    except KeyboardInterrupt:
        link.close()

Example Arduino Sketch:
#include "SerialTransfer.h"

SerialTransfer myTransfer;

void setup()
{
  Serial.begin(115200);
  myTransfer.begin(Serial);
}

void loop()
{
  myTransfer.txBuff[0] = 'h';
  myTransfer.txBuff[1] = 'i';
  myTransfer.txBuff[2] = '\n';

  myTransfer.sendData(3);
  delay(100);

  if(myTransfer.available())
  {
    //do stuff with received packet data
  }
  else if(myTransfer.status < 0)
  {
    Serial.print("ERROR: ");

    if(myTransfer.status == -1)
      Serial.println(F("CRC_ERROR"));
    else if(myTransfer.status == -2)
      Serial.println(F("PAYLOAD_ERROR"));
    else if(myTransfer.status == -3)
      Serial.println(F("STOP_BYTE_ERROR"));
  }
}

Note that you can send more than just individual chars with these libraries. It is possible to transfer floats, ints, bytes, arrays, and even structs (or any combination of the like) within your program using the libraries! See the examples in SerialTransfer.h for more info
For theory behind robust serial communication, check out the tutorials Serial Input Basics and Serial Input Advanced.
EDIT:

Applying the above example to your case, you can use the following code:
Python:
import time
import struct
from pySerialTransfer import pySerialTransfer as txfer

def stuff_float(txfer_obj, val, start_pos=0):
    '''
    Description:
    ------------
    Insert a 32-bit floating point value into the (pySerialtxfer) TX
    buffer starting at the specified index

    :param txfer_obj: txfer - Transfer class instance to communicate over serial
    :param val:       float - value to be inserted into TX buffer
    :param start_pos: int   - index of TX buffer where the first byte of
                              the float is to be stored in

    :return start_pos: int - index of the last byte of the float in the TX
                             buffer + 1
    '''

    val_bytes = struct.pack('f', val)

    txfer_obj.txBuff[start_pos] = val_bytes[0]
    start_pos += 1
    txfer_obj.txBuff[start_pos] = val_bytes[1]
    start_pos += 1
    txfer_obj.txBuff[start_pos] = val_bytes[2]
    start_pos += 1
    txfer_obj.txBuff[start_pos] = val_bytes[3]
    start_pos += 1

    return start_pos

if __name__ == '__main__':
  try:
    link = txfer.SerialTransfer('COM17')

    link.open()
    time.sleep(2) # allow some time for the Arduino to completely reset
    base = time.time()

    while True:
      time.sleep(0.2)

      sent = time.time() - base
      stuff_float(link, sent)
      link.send(4)

      while not link.available():
        if link.status < 0:
          print('ERROR: {}'.format(link.status))

      response = ''
      for index in range(link.bytesRead):
        response += chr(link.rxBuff[index])

      print('SENT: {}'.format(sent))
      print('RCVD: {}'.format(response))
      print(' ')

  except KeyboardInterrupt:
    link.close()

Arduino:
#include "SerialTransfer.h"

SerialTransfer myTransfer;

char buff[25];
char str[] = "I got this: %s%d.%04d";
float fromPython = 0;

void setup()
{
  Serial.begin(115200);
  myTransfer.begin(Serial);
}

void loop()
{
  if(myTransfer.available())
  {
    //////////////////////////////////////////////
    // handle call from Python
    myTransfer.rxObj(fromPython, sizeof(fromPython));

    char sign = (fromPython < 0) ? '-' : ' ';
    uint16_t integer = fromPython;
    float tmpFrac = fromPython - integer;
    uint16_t decimal = trunc(tmpFrac * 10000);
    sprintf(buff, str, sign, integer, decimal);
    //////////////////////////////////////////////

    //////////////////////////////////////////////
    // send response
    myTransfer.txObj(buff, sizeof(buff));
    myTransfer.sendData(sizeof(buff));
    //////////////////////////////////////////////
  }
}

Verified Python Output:
SENT: 0.20032477378845215
RCVD: I got this: 0.2003

SENT: 0.4077117443084717
RCVD: I got this: 0.4077

SENT: 0.61326003074646
RCVD: I got this: 0.6132

Yet another edit:

Inspired by the answer submitted by OP, I updated the library (1.2.0) to include the member functions tx_obj() and rx_obj(). These will allow you to automatically send and receive nearly any standard Python object types (including lists and dictionaries).
Example Python Code:
import time
from pySerialTransfer import pySerialTransfer as txfer

if __name__ == '__main__':
    try:
        link = txfer.SerialTransfer('COM17')

        link.open()
        time.sleep(2) # allow some time for the Arduino to completely reset

        while True:
            send_size = 0

            ###################################################################
            # Send a list
            ###################################################################
            list_ = [1, 3]
            list_size = link.tx_obj(list_)
            send_size += list_size

            ###################################################################
            # Send a string
            ###################################################################
            str_ = 'hello'
            str_size = link.tx_obj(str_, send_size) - send_size
            send_size += str_size

            ###################################################################
            # Send a float
            ###################################################################
            float_ = 5.234
            float_size = link.tx_obj(float_, send_size) - send_size
            send_size += float_size

            ###################################################################
            # Transmit all the data to send in a single packet
            ###################################################################
            link.send(send_size)

            ###################################################################
            # Wait for a response and report any errors while receiving packets
            ###################################################################
            while not link.available():
                if link.status < 0:
                    if link.status == -1:
                        print('ERROR: CRC_ERROR')
                    elif link.status == -2:
                        print('ERROR: PAYLOAD_ERROR')
                    elif link.status == -3:
                        print('ERROR: STOP_BYTE_ERROR')

            ###################################################################
            # Parse response list
            ###################################################################
            rec_list_  = link.rx_obj(obj_type=type(list_),
                                     obj_byte_size=list_size,
                                     list_format='i')

            ###################################################################
            # Parse response string
            ###################################################################
            rec_str_   = link.rx_obj(obj_type=type(str_),
                                     obj_byte_size=str_size,
                                     start_pos=list_size)

            ###################################################################
            # Parse response float
            ###################################################################
            rec_float_ = link.rx_obj(obj_type=type(float_),
                                     obj_byte_size=float_size,
                                     start_pos=(list_size + str_size))

            ###################################################################
            # Display the received data
            ###################################################################
            print('SENT: {} {} {}'.format(list_, str_, float_))
            print('RCVD: {} {} {}'.format(rec_list_, rec_str_, rec_float_))
            print(' ')

    except KeyboardInterrupt:
        link.close()

    except:
        import traceback
        traceback.print_exc()

        link.close()

Example Arduino Code:
#include "SerialTransfer.h"

SerialTransfer myTransfer;

void setup()
{
  Serial.begin(115200);
  myTransfer.begin(Serial);
}

void loop()
{
  if(myTransfer.available())
  {
    // send all received data back to Python
    for(uint16_t i=0; i < myTransfer.bytesRead; i++)
      myTransfer.txBuff[i] = myTransfer.rxBuff[i];

    myTransfer.sendData(myTransfer.bytesRead);
  }
}

Thanks, Luke. Indeed, Serial Inputs Basics was the foundation from which I wrote what I started with - looks like a lot more reading to do with Advanced! I have been using pyserial, but I tried your suggestion by transitioning to pySerialTransfer, using exactly the code in those examples (except the port # of course). After about 2sec, the Mega RX light flashes, but otherwise, I see no feedback on the python terminal; the error, nor the response received. I'm probably doing something wrong, but at the moment, at least pyserial gave some indication there was sending & rec'ving interspersed. Tx!

The example assumed the user was using a second, separate serial port on the Arduino for the Python comms while using Serial for debug prints. I updated the example code and should work flawlessly for you now!

Thanks - updated code based on your example, getting on the right path it seems, but still some issues. Updated question with new code.

I added some blinking of the LED on the board to determine that, despite the python terminal indicating it sent some text, the if statement never evaluates to true.  Code updated to indicate what I've tested; in short, I never get to the blink(60; statement.

@DavidW See my edited answer for a working example that should work for your specific use-case. I successfully verified the exact code with Python 3.7 and one of my Megas.

Beautiful - thank you! Works perfectly. I've added a little more in a subsequent answer to pack other object types. Appreciate your help here.

@DavidW - I edited my answer one more time, lol. I added some helper functions to the library inspired by your answer. Make sure to update your local copy of pySerialTransfer before attempting to use the new funcitons.

Building on P_B's answer to pack additional data types, I extended the python as follows. Of course, the receiving Arduino code needs to receive into the correct data type as well.
def StuffInt(txfer_obj, int_to_send, start_pos=0):
  """Insert integer into pySerialtxfer TX buffer starting at the specified index."""
  return StuffObject(txfer_obj, int_to_send, 'i', 4, start_pos=0)

def StuffFloat(txfer_obj, float_to_send, start_pos=0):
  """Insert integer into pySerialtxfer TX buffer starting at the specified index."""
  return StuffObject(txfer_obj, float_to_send, 'f', 4, start_pos=0)

def StuffStr(txfer_obj, string_to_send, max_length=None, start_pos=0):
  """Insert string into pySerialtxfer TX buffer starting at the specified index.

  Args:
    txfer_obj: see StuffObject
    string_to_send: see StuffObject
    max_length: if provided, the string is truncated to the requested size; otherwise
      defaults to the length of the string
    object_byte_size: integer number of bytes of the object to pack
    start_pos: see StuffObject
  Returns:
    start_pos for next object
  """
  if max_length is None:
    max_length = len(string_to_send)
  format_string = '%ds' % max_length
  truncated_string = string_to_send[:max_length]
  truncated_string_b = bytes(truncated_string, 'ascii')
  print (truncated_string_b)
  return StuffObject(txfer_obj, truncated_string_b, format_string, max_length, start_pos=0)

def StuffObject(txfer_obj, val, format_string, object_byte_size, start_pos=0):
  """Insert an object into pySerialtxfer TX buffer starting at the specified index.

  Args:
    txfer_obj: txfer - Transfer class instance to communicate over serial
    val: value to be inserted into TX buffer
    format_string: string used with struct.pack to pack the val
    object_byte_size: integer number of bytes of the object to pack
    start_pos: index of the last byte of the float in the TX buffer + 1

  Returns:
    start_pos for next object
  """
  val_bytes = struct.pack(format_string, val)
  for index in range(object_byte_size):
    txfer_obj.txBuff[index + start_pos] = val_bytes[index]
  return object_byte_size + start_pos


text:
NodeMCU v2 with MH-Z19B CO2 sensor UART read problem
I'm trying to read data from MH-Z19B sensor to NodeMCU v2 board with a simple circuit like this.

Some key points, which could be not that obvious from picture:
 - sensor has separate power supply of 4 AAs, providing ~5,5V
 - sensor's TX connected to GPIO15 (TX D2) of NodeMCU
 - sensor's RX connected to GPIO13 (RX D2) of NodeMCU
And here is my sketch:
const byte readCommand[] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79}; // according to datasheet
unsigned char response[9];

void setup() {
  // according to datasheet, sensor uses 9600 baud, 8 databits and 1 stopbit
  // with parity NONE, which I believe corresponds to default config SERIAL_8N1
  Serial.begin(9600);
}

void loop() {

    //  ... check if it is time to measure

    Serial.swap(); // switch to sensor

    Serial.write(readCommand, sizeof(readCommand));

    memset(response, 0, sizeof(response));

    int attempts = 5;
    int available = Serial.available();
    while(available < sizeof(response) && attempts > 0) {
        delay(100);
        attempts--;
        available = Serial.available();
    }

    Serial.readBytes(response, sizeof(response));

    Serial.swap(); // switch back to console

    // print out the response in hex
    for (int i = 0; i < sizeof(response); i++) {
      Serial.print(String(response[i], HEX));
      Serial.print("   ");
    }

    // ...process the response according to protocol
}

The Problem
For some reason after sending command to serial I get an answer exactly the same as command is although the structure of answer expected to be different. Of course datasheet says nothing about situations like this.
Expectation
ff 86 .. .. 0 0 0 0 CRC

Reality (same bytes I sent as a command)
ff   1   86   0   0   0   0   0   79

Other notes:
 - I got exactly the same when tried to use SoftwareSerial with D1 & D2 pins
 - connecting TX to RX respectively on both sensor and MCU results in reading failure
 - I tried to pull everything while available from serial, there are only my expected 9 bytes
 - my soldering skills are far from ideal, but I'm pretty sure tx/rx on the sensor are connected properly
I'm new to all this stuff, so it is completely possible that there is ridiculously silly, but crucial mistake, so would appreciate any help on this. And I understand that sensor also has additional interfaces to obtain the value, but as I mentioned I'm a newbie and wanted to familiarize myself with UART as this is something new for me.
UPD 1:
I didn't use level conversion for sensor output as datasheet says:

Assuming this I thought that sensor provides logical level conversion itself. Did I get it wrong?
UPD 2:
I got back to proper TX - RX connection just to check out what is going on exactly to describe that "reading failure" problem with more details. It seems that Serial.available() returns 0 after I send command so this loop gets stopped after 5 attempts:
while(available < sizeof(response) && attempts > 0)

It has to be RX to TX with UART. That it results in reading failure is another problem. What exactly do you mean by "reading failure"?

You don't step down the TX voltage of the sensor from 5V to 3.3V for the NodeMCU. That is risky, as you might destroy the RX pin of the NodeMCU

@chrisl thank you for your comments, I updated my question with some details regarding that reading failure case and my assumptions I took from datasheet which made me think I don't need 3,3 level conversion.

It says in your description that you have the Rx connected to Rx and the Tx connected to Tx.  That's backwards.  What one transmits the other needs to receive.  When you have a conversation with someone, do you talk into their mouth and listen to their ears?  You should have Rx-Tx and Tx-Rx.
You also need to be sure that it is OK to feed a 5V Tx into that Rx pin.  On some ESP8266 boards it is and on most it isn't.  If you don't have one of the boards that specifically has circuitry built in to handle 5V inputs then you will fry your NodeMCU

Thank you for your answer. I added a screenshot from sensor's datasheet which says that it provides UART 3,3 so I thought that level conversion was made on sensor's side. Did I get it wrong?

If it does give 3V3 then you're safe.  It appeared from your question that it was 5V.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Arduino Yún console clear
I'm having a problem. I want to clear the screen on the connected console. And after the clear, I want to rerun my code. But I can't seem to figure out how to do it. Below is some part of the code:
#include <motorStyring.h>
#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>
#define PORT 6666
motorStyring mt;
int cm;

  YunServer server(PORT);
  const int pingPin = 9;
  int led = 13;
    void setup() {

    Serial.begin(115200);
    Bridge.begin();
    server.noListenOnLocalhost();
    server.begin();
 }
    void loop() {
    long duration, inches, cm;
    pinMode(pingPin,OUTPUT);
    digitalWrite(pingPin,LOW);
    delayMicroseconds(2);
    digitalWrite(pingPin, HIGH);
    delayMicroseconds(5);
    digitalWrite(pingPin,LOW);
    pinMode(pingPin, INPUT);
    duration = pulseIn(pingPin,HIGH);
    cm = microsecondsToCentimeters(duration);
    h();
   }
    void h()
   {
    YunClient client = server.accept();
     if (client.connected()) {
      String question = "What would you like to drink?\nyou have 4    choises:\n1)Juice\n2)Vodca\n3)Soda\n4)Mix\n";
client.write((uint8_t*)&question[0], question.length());
String response;
while (client.connected()) {
  if (client.available()) {
    char cmd = client.read();
    if (cmd == '\n') {
      break;
    } else {
      response += String(cmd);
    }
  }
}
if (response == "juice") {
  juice();

} else if (response == "vodka") {
  vodka();

} else if (response == "soda") {
  soda();

} else if (response == "mix") {
  mix();

} else {

  String error = "you didn't select anything that corrospond to an option. \n try agin";
  client.write((uint8_t*)&error[0], error.length());
 }
   String awnser = "Here is your " + response;
   client.write((uint8_t*)&awnser[0], awnser.length());
 }
 delay(1000);
}

...
Is there a way to clear the screen on the console, so that all of the text from the previous code is not disturbing the user?

Perhaps you could count the number of lines in the console and the print out enough carriage returns ("\n") to fill it with empty whitespace.
For example, with a console with 100 lines:
for(int iter = 0; iter < 100; iter++) {
   client.write('\n');
}

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

authors: webknjaz -- Слава Україні


text:
Nested for loop errors
Ok, I am trying to make 2 LEDs run at two different speeds.
Here is the code I am using:
void setup() {

  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
}

for ( ; ; ) {
  for ( ; ; ) {
   digitalWrite(12, HIGH);
   delay(250);
   digitalWrite(12, LOW);
   delay(250);
  }
  digitalWrite(13, HIGH);
  delay(500);
  digitalWrite(13, LOW);
  delay(500);
}

This code unfortunately returns this error:
error: expected unqualified-id before 'for'
 for ( ; ; ) {

Thanks for the help!

Where is your loop function...?

where should it be?

Around your (pointless) for loops?

Like what would that code look like?

It would look like all the examples in the IDE - especially the blink example.

First of all your question is so basic it means you didn't spend any time to look any example out there, not even after Majenko has clearly pointed out you can find the answer to your question in the many examples out there.
Once that is clear here follow the code you are looking for, but using it as it is without knowing what you are doing is not going to help you. Not to mention not many will be willing to help somebody with the attitude you are demonstrating.
#define LED_1 5
#define LED_2 6

void setup() {
  pinMode(LED_1, OUTPUT);
  pinMode(LED_2, OUTPUT);
}

long one, two;
bool led_1, led_2;

void loop() {
  if (millis() - one >= 250) {
    digitalWrite(LED_1, led_1++);
    one = millis();
  }

  if (millis() - two >= 500) {
    digitalWrite(LED_2, led_2++);
    two = millis();
  }
}

One correction, never compare millis() like that. Always make >=, because it will be rarely equal to 250 or 500 and it will never run code.

You are 100% right, thanks for spotting the mistake: fix applied. For those reading the comment afterwards, I erroneously had an equality comparison == instead of a greater than comparison >= on the two if statements.

As Majenko's comments are suggesting you're missing the loop function here - which is not just eye candy but essential. It is the basic structure of the sketches to have two methods on the highest (user accessible) level: void setup() and void loop(). setup is run exactly once at the beginning of your program. Following that loop is looped (hence the name) forever.
This is what it should look like:
void setup() {
  // doing the setup
}

void loop() {
    for ( ; ; ) {
        for ( ; ; ) {
            // something
        }
        // something else
    }
}

However (and again Majenko's comment hints it) something else is never going to be executed as the inner loop is never exited. This tutorial (per Majenko's comment) should get you started. See also: www.arduino.cc with many more tutorials worth studying.

so how do I make it run both at the same time?

Start with the BlinkWithoutDelay example.

You have a compiler error because you have executable code outside a function. In particular your first "for" loop.
Second, an infinite loop inside an infinite loop is not particularly useful.

so how do I make it run both at the same time?

Ah yes, well unless you have multiple CPUs you don't run multiple things "at the same time". You do one thing, and then another thing.
I have an article about this general idea here:
http://www.gammon.com.au/blink
To save having to necessarily go to that link, here is an example from that page which blinks two LEDs at different rates:
// Which pins are connected to which LED
const byte greenLED = 12;
const byte redLED = 13;

// Time periods of blinks in milliseconds (1000 to a second).
const unsigned long greenLEDinterval = 500;
const unsigned long redLEDinterval = 1000;

// Variable holding the timer value so far. One for each "Timer"
unsigned long greenLEDtimer;
unsigned long redLEDtimer;

void setup ()
  {
  pinMode (greenLED, OUTPUT);
  pinMode (redLED, OUTPUT);
  greenLEDtimer = millis ();
  redLEDtimer = millis ();
  }  // end of setup

void toggleGreenLED ()
  {
   if (digitalRead (greenLED) == LOW)
      digitalWrite (greenLED, HIGH);
   else
      digitalWrite (greenLED, LOW);

  // remember when we toggled it
  greenLEDtimer = millis ();
  }  // end of toggleGreenLED

void toggleRedLED ()
  {
   if (digitalRead (redLED) == LOW)
      digitalWrite (redLED, HIGH);
   else
      digitalWrite (redLED, LOW);

  // remember when we toggled it
  redLEDtimer = millis ();
  }  // end of toggleRedLED

void loop ()
  {

  // Handling the blink of one LED.
  if ( (millis () - greenLEDtimer) >= greenLEDinterval)
     toggleGreenLED ();

  // The other LED is controlled the same way. Repeat for more LEDs
  if ( (millis () - redLEDtimer) >= redLEDinterval)
    toggleRedLED ();

/* Other code that needs to execute goes here.
   It will be called many thousand times per second because the above code
   does not wait for the LED blink interval to finish. */

}  // end of loop

In that code, in the main loop, the code uses millis() to find the current time, and if sufficient time has elapsed it does something useful. As an analogy, when you are cooking dinner you look at the clock from time to time, and if sufficient time has elapsed since you started cooking, you take the roast from the oven and eat it.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Can I make existing libraries use external SRAM for the Arduino
I am running out of memory on my Arduino due to the libraries I am using. After I have included all the libraries I need then there is very little in the way of free memory for my own code.
If hook up some external RAM to the Arduino, is there a way I can make existing libraries use the external RAM rather than the SRAM on the arduino or will I need to alter the code in the library to do it.
If I have to modify the code is that a relatively easy thing to do?

Hello and welcome. I would think that this is very specific to the libraries involved (could you specify them?) - albeit somewhat unlikely in a generic sense.

Thanks for the welcome :-) The ones I am thinking of at the moment are the Adafruit OLED library here and the SD card library here

What did programmers do back in the 80-ies when they run out of memory?

There is an old technique called overlays. The same area of memory is used for different phases/steps of a program. Results are naturally saved but any intermediate data is discharged before the next phase/step which reuses the "common" area of memory. Necessary state may be saved to an external storage between execution of the phase/step to increase available local memory.
To compile and link this you have to do some deep diving into the manual and read up on memory sections.
It is possible to abstract this using C++ smart pointers but getting existing libraries to use it will be a very tough challenge. There are a few attempts to support virtual memory such as virtmem.
Cheers!

Thanks. I have seen the virtmem library before in passing but took a close look and it looks like it might get me part of the way there.

Before considering using overlay, virtual memory and external memory (e.g. SPI RAM) use all the available tricks to reduce SRAM usage such as the F() macro, limit the usage of String class, reducing allocation size, packing struct's, etc.

Making a library use external SRAM is not an easy task. It can be cone, but it takes quite a bit of work.
The best start would be to abstract the SRAM into a library that provides simple access to it. Then you would need to use that new library to read and write data in the SRAM instead of accessing variables in the other libraries.
There is no way of simply mapping a variable into external SRAM - for that you need a microcontroller with an MMU  and/or an EIB.


text:
I have a problem uploading blink
I am uncertain what a serial monitor does when I try uploading blink.  I get:
problem uploading to board avrdude stk500_recv910 programmer is not responding

Sorry, that has to be a typo: programmer is you?

You are correct: this is a real message. It means you have misswired your serial lines.

Actually it can be any serial port error.

Blink uploads easily, so we'll need more information - Are you using a USB serial cable, for instance?  Have you selected the correct board and port?

You have probably not chosen the right COM port. Try picking a different COM port, if using USB cable.

This answer is rather terse and would have probably been better as a comment. If you could expand your answer, maybe explaining where to change the COM pot and a screenshot, that would be great.

authors: عباس محیاپور لری


text:
Keypad code not working
I am new I took a code of keypad in arduino. Arduino code is not working in setup area but if I place the same code in loop are it works why? Kindly guide me.
Here is the code.
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'0','1','2','3'},
  {'4','5','6','7'},
  {'8','9','A','B'},
  {'C','D','E','F'}
};
byte rowPins[ROWS] = {2, 3, 4,5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6, 7, 8, 9}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

void setup(){
  Serial.begin(9600);
  char customKey = customKeypad.getKey();

  if (customKey){
    Serial.println(customKey);
  }
}

void loop(){

}

Please note that setup() runs just once while loop() is repeated forever (see e.g. here) that's an important difference.

but it must run once, it is not .

It is. It's just running waaaaay faster than you can press a key.

I think you need to learn the difference between "Running once right at the very start" and "Getting one keypress". The two concepts are completely different.

Ok thanks alot.

To illustrate what the are talking about, try putting an else on your if.... I.e. else { Serial.println("no key press"); } . As a bonus you will get a free game called "can I beat the no key press message?" :-)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
HTTP POST from Arduino/ESP8266/ESP32 How to send parameters (x-www-form-urlencoded)

EDIT: Thank you for the answer, also we had figured out how to do it Micropython too - I believe that it is relevant for the Arduino/ESP8266/ESP32 community to share this too.
https://github.com/46elks/46elks-getting-started/blob/master/code-examples/MicroPython/https_post_with_micropython.py
How should I include parameters from, to and message to http.post?
Is this the correct way to do it?
http.POST("'from:+XXXXX','to:+XXXXX','message:Hej'");
#include <M5StickC.h>
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiMulti.h>

#include <HTTPClient.h>

#define USE_SERIAL Serial

WiFiMulti wifiMulti;

void setup() {

    USE_SERIAL.begin(115200);

    USE_SERIAL.println();
    USE_SERIAL.println();
    USE_SERIAL.println();

    for(uint8_t t = 4; t > 0; t--) {
        USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
        USE_SERIAL.flush();
        delay(1000);
    }

    wifiMulti.addAP("YYYY", "ZZZZZ");

}

void loop() {
    // wait for WiFi connection
    if((wifiMulti.run() == WL_CONNECTED)) {

        HTTPClient http;

        USE_SERIAL.print("[HTTP] begin...\n");
        // configure traged server and url

          http.begin("https://api.46elks.com/a1/sms");
          http.addHeader("Content-Type", "application/x-www-form-urlencoded");
          http.setAuthorization("XXXXX", "YYYYYY");
          int httpCode = http.POST("'from:+XXXXX','to:+XXXXX','message:Hej'");

        USE_SERIAL.print("[HTTP] GET...\n");
        // start connection and send HTTP header
         httpCode = http.GET();

        // httpCode will be negative on error
        if(httpCode > 0) {
            // HTTP header has been send and Server response header has been handled
            USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);

            // file found at server
            if(httpCode == HTTP_CODE_OK) {
                String payload = http.getString();
                USE_SERIAL.println(payload);
            }
        } else {
            USE_SERIAL.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
        }

        http.end();
    }

    delay(10000);
}

what does the server expect? x-www-form-urlencoded format is name=value&nextname=nextvalue. so with = as name value separator and & as name-value pairs separator.

What format of message does the server expect? As you send "x-www-form-urlencoded" it should probably look like:
 "from=+XXXXX&to=+XXXXX&message=Hej"

where the different parts are
 "param1=paramValue1&param2=paramValue2&param3=paramValue3"

 param .... Name of the expected parameter
 = .... divides the param pair
 paramValue .... Content/value of the parameter
 & .... links the param pairs

so in your case
 int httpCode = http.POST("from=+XXXXX&to=+XXXXX&message=Hej");

Note that, in x-www-form-urlencoded, the “+” character is used to encode a space. If you mean a literal “+”, you should encode it as “%2B”.

My friend and I figured out how to do this in micropython - can I make a question about it and answer it or should I post it here somehow?
https://github.com/46elks/46elks-getting-started/blob/master/code-examples/MicroPython/https_post_with_micropython.py

Place the link and short explanation as an EDIT to your question, this way everything is together and helps others Thank you


text:
Esp8266: Linux - fatal: No names found and undefined reference to `app_entry_custom()'
as Gentoo user I build everything from sources, but I have problem with building toolchain for esp8266. I came up with this script:
#!/bin/sh

# note: eselect python2 before, because of gcc

# prepare board
mkdir -p ~/Arduino/hardware/esp8266com
cd ~/Arduino/hardware/esp8266com
git clone --recursive --depth 1 https://github.com/esp8266/Arduino.git esp8266

# use system python3
mkdir esp8266/tools/python3
ln -s /usr/bin/python3 esp8266/tools/python3/python3

# build toolchain
cd ~/Arduino
git clone --recursive --depth 1 https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
sed -i "193s/.*/                     |\$EGREP '^GNU bash, version (3\\.[1-9]|4|5)')/" crosstool-NG/configure.ac # add bash5 support
echo CT_DEBUG_gdb=n >> crosstool-config-overrides # don't build gdb
make STANDALONE=n

# "install" esp-open-sdk
ln -sf ~/Arduino/esp-open-sdk/xtensa-lx106-elf ~/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf

It builded successfully, but I get errors during building project:
(…)
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/python3/python3 /home/urhen/Arduino/hardware/esp8266com/esp8266/tools/makecorever.py --build_path /tmp/arduino_build_179995 --platform_path /home/urhen/Arduino/hardware/esp8266com/esp8266 --version unix-2.7.0-dev
fatal: No names found, cannot describe anything.
(…)
Linking everything together...
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -CC -E -P -DVTABLES_IN_FLASH /home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/ld/eagle.app.v6.common.ld.h -o /tmp/arduino_build_179995/local.eagle.app.v6.common.ld
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -fno-exceptions -Wl,-Map -Wl,/tmp/arduino_build_179995/sketch_apr19a.ino.map -g -Wall -Wextra -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static -L/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/lib -L/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/lib/NONOSDK22x_190703 -L/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/ld -L/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/lib -Teagle.flash.4m2m.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o /tmp/arduino_build_179995/sketch_apr19a.ino.elf -Wl,--start-group /tmp/arduino_build_179995/sketch/sketch_apr19a.ino.cpp.o /tmp/arduino_build_179995/core/core.a -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group -L/tmp/arduino_build_179995
/tmp/arduino_build_179995/core/core.a(core_esp8266_main.cpp.o):(.text.app_entry+0x0): undefined reference to `app_entry_custom()'
/tmp/arduino_build_179995/core/core.a(core_esp8266_main.cpp.o): In function `app_entry':
/home/urhen/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_main.cpp:318: undefined reference to `app_entry_custom()'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.

What am I missing?
Log:
/usr/share/arduino/arduino-builder -dump-prefs -logger=machine -hardware /usr/share/arduino/hardware -hardware /home/urhen/Arduino/hardware -tools /usr/share/arduino/hardware/tools/avr -libraries /home/urhen/Arduino/libraries -fqbn=esp8266com:esp8266:d1_mini:xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600 -ide-version=10807 -build-path /tmp/arduino_build_418955 -warnings=all -prefs=build.warn_data_percentage=75 -verbose /tmp/untitled878766377.tmp/sketch_apr19a/sketch_apr19a.ino
/usr/share/arduino/arduino-builder -compile -logger=machine -hardware /usr/share/arduino/hardware -hardware /home/urhen/Arduino/hardware -tools /usr/share/arduino/hardware/tools/avr -libraries /home/urhen/Arduino/libraries -fqbn=esp8266com:esp8266:d1_mini:xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600 -ide-version=10807 -build-path /tmp/arduino_build_418955 -warnings=all -prefs=build.warn_data_percentage=75 -verbose /tmp/untitled878766377.tmp/sketch_apr19a/sketch_apr19a.ino
Using board 'd1_mini' from platform in folder: /home/urhen/Arduino/hardware/esp8266com/esp8266
Using core 'esp8266' from platform in folder: /home/urhen/Arduino/hardware/esp8266com/esp8266
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/python3/python3 /home/urhen/Arduino/hardware/esp8266com/esp8266/tools/makecorever.py --build_path /tmp/arduino_build_418955 --platform_path /home/urhen/Arduino/hardware/esp8266com/esp8266 --version unix-2.7.0-dev
Detecting libraries used...
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/include -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include -I/tmp/arduino_build_418955/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10807 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_WEMOS_D1MINI\"" -DFLASHMODE_DIO -DESP8266 -I/home/urhen/Arduino/hardware/esp8266com/esp8266/cores/esp8266 -I/home/urhen/Arduino/hardware/esp8266com/esp8266/variants/d1_mini /tmp/arduino_build_418955/sketch/sketch_apr19a.ino.cpp -o /dev/null
Generating function prototypes...
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/include -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include -I/tmp/arduino_build_418955/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10807 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_WEMOS_D1MINI\"" -DFLASHMODE_DIO -DESP8266 -I/home/urhen/Arduino/hardware/esp8266com/esp8266/cores/esp8266 -I/home/urhen/Arduino/hardware/esp8266com/esp8266/variants/d1_mini /tmp/arduino_build_418955/sketch/sketch_apr19a.ino.cpp -o /tmp/arduino_build_418955/preproc/ctags_target_for_gcc_minus_e.cpp
/usr/bin/arduino-ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino_build_418955/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/python3/python3 /home/urhen/Arduino/hardware/esp8266com/esp8266/tools/signing.py --mode header --publickey /tmp/untitled878766377.tmp/sketch_apr19a/public.key --out /tmp/arduino_build_418955/core/Updater_Signing.h
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/include -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include -I/tmp/arduino_build_418955/core -c -Wall -Wextra -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10807 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_WEMOS_D1MINI\"" -DFLASHMODE_DIO -DESP8266 -I/home/urhen/Arduino/hardware/esp8266com/esp8266/cores/esp8266 -I/home/urhen/Arduino/hardware/esp8266com/esp8266/variants/d1_mini /tmp/arduino_build_418955/sketch/sketch_apr19a.ino.cpp -o /tmp/arduino_build_418955/sketch/sketch_apr19a.ino.cpp.o
Compiling libraries...
Compiling core...
Using previously compiled file: /tmp/arduino_build_418955/core/cont.S.o
Using previously compiled file: /tmp/arduino_build_418955/core/umm_malloc/umm_info.c.o
Using previously compiled file: /tmp/arduino_build_418955/core/umm_malloc/umm_integrity.c.o
Using previously compiled file: /tmp/arduino_build_418955/core/umm_malloc/umm_local.c.o
Using previously compiled file: /tmp/arduino_build_418955/core/umm_malloc/umm_poison.c.o
Using previously compiled file: /tmp/arduino_build_418955/core/Esp-frag.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/core_esp8266_postmortem.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/WMath.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/heap.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/core_esp8266_sigma_delta.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/WString.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/libc_replacements.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/core_esp8266_si2c.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/gdb_hooks.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/core_esp8266_timer.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/spiffs_api.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/Stream.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/abi.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/Esp.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/Esp-version.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/include -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include -I/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include -I/tmp/arduino_build_418955/core -c -Wall -Wextra -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10807 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_WEMOS_D1MINI\"" -DFLASHMODE_DIO -DESP8266 -I/home/urhen/Arduino/hardware/esp8266com/esp8266/cores/esp8266 -I/home/urhen/Arduino/hardware/esp8266com/esp8266/variants/d1_mini /home/urhen/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Updater.cpp -o /tmp/arduino_build_418955/core/Updater.cpp.o
Using previously compiled file: /tmp/arduino_build_418955/core/core_esp8266_spi_utils.cpp.o
[cut due to characters limit]
Using previously compiled file: /tmp/arduino_build_418955/core/Schedule.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/Esp-frag.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/Esp-version.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/Esp.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/FS.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/FSnoop.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/FunctionalInterrupt.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/HardwareSerial.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/IPAddress.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/MD5Builder.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/Print.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/Schedule.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/StackThunk.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/Stream.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/StreamString.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/Tone.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/Updater.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/WMath.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/WString.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/abi.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/base64.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/cbuf.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/cont.S.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/cont_util.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_app_entry_noextra4k.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_eboot_command.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_features.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_flash_utils.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_i2s.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_main.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_noniso.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_phy.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_postmortem.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_si2c.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_sigma_delta.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_spi_utils.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_timer.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_waveform.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_wiring.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_wiring_analog.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_wiring_digital.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_wiring_pulse.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_wiring_pwm.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/core_esp8266_wiring_shift.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/crc32.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/debug.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/flash_hal.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/gdb_hooks.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/heap.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/libb64/cdecode.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/libb64/cencode.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/libc_replacements.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/sntp-lwip2.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/spiffs/spiffs_cache.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/spiffs/spiffs_check.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/spiffs/spiffs_gc.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/spiffs/spiffs_hydrogen.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/spiffs/spiffs_nucleus.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/spiffs_api.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/sqrt32.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/time.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/uart.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/umm_malloc/umm_info.c.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/umm_malloc/umm_integrity.c.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/umm_malloc/umm_local.c.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/umm_malloc/umm_malloc.cpp.o
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_418955/core/core.a /tmp/arduino_build_418955/core/umm_malloc/umm_poison.c.o
Linking everything together...
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -CC -E -P -DVTABLES_IN_FLASH /home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/ld/eagle.app.v6.common.ld.h -o /tmp/arduino_build_418955/local.eagle.app.v6.common.ld
/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -fno-exceptions -Wl,-Map -Wl,/tmp/arduino_build_418955/sketch_apr19a.ino.map -g -Wall -Wextra -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static -L/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/lib -L/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/lib/NONOSDK22x_190703 -L/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/ld -L/home/urhen/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/lib -Teagle.flash.4m2m.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o /tmp/arduino_build_418955/sketch_apr19a.ino.elf -Wl,--start-group /tmp/arduino_build_418955/sketch/sketch_apr19a.ino.cpp.o /tmp/arduino_build_418955/core/core.a -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group -L/tmp/arduino_build_418955
/tmp/arduino_build_418955/core/core.a(core_esp8266_main.cpp.o):(.text.app_entry+0x0): undefined reference to `app_entry_custom()'
/tmp/arduino_build_418955/core/core.a(core_esp8266_main.cpp.o): In function `app_entry':
/home/urhen/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_main.cpp:318: undefined reference to `app_entry_custom()'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.

You did a shallow copy of the git repo:
The solution is to ensure that the initial clone of the repo in the build environment was not a shallow clone (i.e. the git clone command was not used with --depth, --shallow-since or --shallow-exclude parameters).
 so change your
git clone --recursive --depth 1 https://github.com/esp8266/Arduino.git esp8266
....
git clone --recursive --depth 1 https://github.com/pfalcon/esp-open-sdk.git

to
git clone --recursive https://github.com/esp8266/Arduino.git esp8266
....
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git

and make sure your *.ino contains at least
 setup(){}

AND
loop(){}

This fixed "fatal: No names found, cannot describe anything.", but there are still "undefined reference to `app_entry_custom()'".

Can you now ADD the current error message  to your question (edit it) - because error message have to be worked top down not bottom up -btw whats in the sketch apr*.ino? Are you using docker images?

apr*.ino is empty setup() and main(), I don't use docker.

See my edit in the answer

My *.ino is fine, this linker error mean that I lacking some shared object (I'm not sure if I can call it that in this case), but I have no clue which file it need and how to add it.


text:
Arduino Uno SD card storage
I am interested in storing accelerometer data to an SD card. Since power consumption is the main consideration of my project, it is important to do as few writes to the SD as possible, because the SD requires much current, and also takes long to be written, keeping my MCU from sleeping.

The data to be stored are about 50 bits of data at 10Hz, so I need to store 500c bits per second, or around 63 bytes per second. The arduino uno EEPROM is 1024 bytes, which could give me around 16 seconds of data stored before having to access my SD card. However I have seen that the EEPROM has limited write cycles (100000). So each byte can be written 100000 times, which gives us a total of 1000*100000=100000000 bytes to be written.As a result, with writing there 63 bytes per second, that would give me 1587301 seconds=441hours=18days of EEPROM lifetime, which is unacceptable. Is this correct?
If (1) is correct and using internal eeprom is not a possible solution, what other recommendations do you have? Is there an alternative to SD storage, that requires less power and less writing time, so that it is cheaper power-wise? The total storage should be around 200MB.

Why do you want to use EEPROM? Why not just a simple buffer array?

@chrisl It is a good idea, on what memory would the buffer array be stored, though?

The buffer would be stored in RAM. Normally EEPROM is only used, when you need persistent storage, which keeps the values over power cycles or resets. But that doesn't seem to be the case for you. Though you still need to see, how big you can make the buffer (that depends on the memory and library usage of your sketch)

Regarding 1, it's true that EEPROM has limited write cycles. Mostly it can be much more, but it's only guaranteed upto that number, so I can imagine you don't want taking the risk to be lucky.
Regarding 2, other solutions could be external SRAM, which can be much more than just 1 KB, but also adds some extra components, thus cost and more important power. When that SRAM is full (can be many KBs), you can transfer it to the SD card.
Another (added) improvement you might think of (if you did not already) is data compression (trying to store the 50 bits in less bits), but this will cost some 'computing' power.

To start with power consumption rules an Arduino UNO out so you will need some device capable of (deep) sleep mode. Devices like ESP8266 or ESP32. The table below shows the differences between each mode (information from the ESP8266 datasheet).
Item                 Modem-sleep        Light-sleep       Deep-sleep
Wi-Fi                   OFF          OFF            OFF
System clock             ON         OFF             OFF
RTC                     ON          ON              ON
CPU                     ON          Pending         OFF
Substrate current     15 mA        0.4 mA          ~20 uA
Avg. current (DTIM = 1) 16.2 mA     1.8 mA            –
Avg. current (DTIM = 3) 15.4 mA     0.9 mA            –
Avg.current (DTIM = 10) 15.2 mA     0.55 mA

These modules have around 4MB flash which yoi could use for storage of data (SPIFFS/LittleFS) so 1MB for programs and 3MB for on board storage, after that you save to SD and fill up the onboard FS again or you send the data via WLAN to an online storage or database or to a server in your network (depending on your scenario) These devices cost as much as an Arduino UNO clone (5-7$) and can be programmed with the same IDEs as Arduinos and in the same (extern C/)C++ derivate. So if power consumption is an issue look at those IoT devices

An Uno can, however, be slept at something like < 10uA, though, using LowPower. I agree that an ESP would be a better choice just because of storage and RAM, but Arduinos can sip when they need to!


text:
UART communication, is it possible to use only the TX line?
I am trying to connect an ESP-01 with an ArduinoMega through the serial port of both, as they use different voltage levels I would need a voltage divider between the TX pin of the Mega (pin 1) and the pin RX of the ESP-01 (pin 4) , it is not difficult to do, but I just need to "send data" from ESP-01 to Mega, then I have a question and it is as follows:
If I just need to send data from one device to the other, could I just connect the TX pin of the ESP-01 to the RX of the Mega? If I do so, will I receive data in the Mega?
Greetings

Did you try it?

I tried using an FTDItoUSB for the ESP-01, it didn't work for me...the answer that give me back (Arduino IDE and PuTTY) is: "Unable to open PORT4. PORT4 is in use".

OS reporting that the port in use, has nothing to do with what is actually connected to RX and TX pins.

A PC operating system complaint that a port is in use would have nothing to do with the question you posted, but merely be an incidental problem in the course of usage.  Try closing any programs that might use serial communication, including the arduino IDE, serial monitor, tools like putty, defunct instances of avrdude, etc.

I tried restarting the PC (in this scenarios I use Windows) for any rare program, then I tried again using the same configuration, the same result.

the esp-01 will not blow if you connect 5 V logic to it. the io pins are 5 V tolerant. maybe not for long term, but sure for some tests. has this esp-01 some bigger value for you, that you are so cautious?

Yeap, I'm in Cuba and this pieces of technology from "outter space" are veryyyyy difficult to have. If some day you came here, let me know :)

It works! Just (in my case) the TX pin from the ESP goes to the TX pin from the Mega, I don't know why, but work in this way.

Yes.
You can connect only the the line with which the ESP-01 transmits to the Arduino's receiver, and accomplish one-way data transfer.
However, the ESP will have to be willing to transmit without prompting, and you will not be able to use the Arduino to setup or configure it.  Further, you will not be able to use any in-band signalling to ask the ESP to refrain from sending, so you will have to be sure that your Arduino sketch is generally ready to claim any input which may arrive, and that if there are periods when it is not, the behind-the-scenes serial buffer is large enough.
There's also the question if it is safe to connect the ESP transmit pin directly to the Arduino receive.  In the intended direction of operation, it is.  But should you ever load code on the Arduino which uses that pin as a GPIO output, there is some risk of damage to the ESP.  It's up to you to decide if careful usage will be enough to prevent that; if not, you may want to try something like a 1K series resistor and a schottky diode to clamp the line to the ESP's 3.3v supply, in a way that diverts the current from any accidental 5v output around any internal protection diode that may have more limited power handling.

Thanks for the quick answer and for the recommendations! You just give the tips that I was looking for! I just want to connect my phone to the ESP, open any browser and send some data (a color code, wich is just hexadecimal codes), the ESP recieve that data and send to the Mega, the Mega then will select from the hexa-code the color to set to some leds (50 leds from WS2812B led strip). Do you think the serial buffer from the Mega can hold this? And all this for don't put just to resistences!!! :-)

If you don't hammer it with constant requests, yes.  Do note that receiving multi-character strings can take a little care - you might consider adding a terminating newline as a definitive end marker, and then using line-oriented input.

Sorry for for the unknow but: what do you mean when you say: "terminating newline" and "line-oriented input".

Essentially it means typing a value and then hitting the return key, or having a program do so.  This is more deterministic than sending a value and having the Arduino merely wait until it decides you are not going to type any more digits.   You could rig this up with Serial.readBytesUntil() and atoi() but it will require some work.  Unfortunately, the built-in turnkey methods like Serial.parseInt() use the less reliable timeout approach.  Still many seem to manage using those.  You can also see if sending a newline helps parseInt() finish more promptly.

Ok, I got what you say...is like have the Mega waiting for the character "\n", meaning a new line, and then download all you have in the bus of the serial to a variable. Is that what you want to say? Another question come to me: can I use RegularExpresions (regex) in the Mega?

There are no doubt libraries for regular expression that you can use and at the scale you want to use they would likely be workable, but it might be preferable to avoid the need for such heavy string processing on the little tiny Arduino.   Can you clean up the data on the ESP side (or even at the network source) and only send the more Arduino a clean command, like "123\n" ?

Yeap I think that you're rigth, thanks for the directions you gave to me!!!


text:
How to deal with this array correctly?
I am using a led strip WS2812b, an ESP8266 (NodeMCU 1.0) and a gesture sensor APDS9960.
I want that when I move my hand from left to right and from right to left I change the colors of the strip of leds, previously saved in an array of strings:
const char * colors [11] = {"CRGB :: White",
"CRGB :: WhiteSmoke",
"CRGB :: CadetBlue",
"CRGB :: SteelBlue",
"CRGB :: Teal",
"CRGB :: SlateGray" ,
"CRGB :: MediumPurple",
"CRGB :: Purple",
"CRGB :: PapayaWhip",
"CRGB :: LightPink",
"CRGB :: Crimson"};

But when I'm going to turn on the colors using the functions of the FastLed library in this way:
for (int i = 0; i <NUM_LEDS; i = i + 1) {
       leds [i] = colors [2];
       FastLED.show ();
       delay (10);}

All I get is this error:

invalid conversion from 'const char *' to 'uint32_t {aka unsigned
  int}' [-fpermissive]

I guess the problem is me when declaring the array, could someone help me?

You don't want an array of strings containing the (badly formatted) names of variables. Instead you want an array of 32-bit integers containing the values held within those variables.
const uint32_t colors[] = {
    CRGB::White,
    CRGB::WhiteSmoke,
    CRGB::CadetBlue,
    CRGB::SteelBlue,
    CRGB::Teal,
    CRGB::SlateGray,
    CRGB::MediumPurple,
    CRGB::Purple,
    CRGB::PapayaWhip,
    CRGB::LightPink,
    CRGB::Crimson
};

Since colours are just numbers, in the (hexadecimal) form of 0xRRGGBB you just store them as 32-bit unsigned integers.  The names you have there are just such (constant) variables used for easy reference (CRGB::White is 0xFFFFFF).

Thanks!!! Your recomendation did the work correctly!!!
Thanks again!!!


text:
Infrared sending not working slight misconfiguration?
Edit: Took some advice from below but it still doesn't work. I think it probably blocking code but please tell me how I could fix it to send a the valid infrared signal, NOTE: I wouldn't actually code it like this I am just trying to learn and understand how to do it and then make it better after:
uint8_t Status;
uint8_t Counter;
const uint32_t Code[] = {4507,4507,573,1694,573,1694,573,1694,573,573,573,573,573,573,573,573,573,573,573,1694,573,1694,573,1694,573,573,573,573,573,573,573,573,573,573,573,573,573,1694,573,573,573,573,573,573,573,573,573,573,573,573,573,1694,573,573,573,1694,573,1694,573,1694,573,1694,573,1694,573,1694,573,46560};

void setup() {
  pinMode(4, OUTPUT);
}

void loop() {
  while(Counter<70) {
    if (Status=1) {
        digitalWrite(4, HIGH);
        Status=3;
        while(Status=3) {
          delayMicroseconds(26);
          digitalWrite(4, HIGH);
          delayMicroseconds(26);
          digitalWrite(4, LOW);
        }
        delayMicroseconds(Code[Counter]);
        Status=2;
        Counter++;
    } else {
      if (Status=2) {
        digitalWrite(4, LOW);
        Status=0;
        while(Status=0) {
          delayMicroseconds(26);
          digitalWrite(4, HIGH);
          delayMicroseconds(26);
          digitalWrite(4, LOW);
        }
        delayMicroseconds(Code[Counter]);
        Status=1;
        Counter++;
      }
    }
  }
}

It is unclear, what exactly is the problem. Maybe you have some basic misconceptions. Like, that infrared remotes (and also most libraries) use a fixed modulation for the pulses (for example at 38kHz) to get better noise resistance. How are you receiving the IR signal? You need to send an IR signal, that the receiver understands.

Raw infrared timings do not need to specify hz I believe. if you flash a led constantly at 1Hz you would be flashing 1 time per second. 2Hz 2 times per second. The actual infrared timings in the Buf variable do not need to specifcy a frequency since they are RAW. So the code above It starts with the first 4507 and that would be the delay. the (timing). I believe that's how it works after reading alot about infrared. But the problem im having is that I don't know how to implement it i guess? do I flash delay for 4507 and then keep it off for 4507? I know how it works but need help debuging this

No, I'm very sure, that you don't just send raw on and off cycles with the LED, though that depends on what you use to receive the signal. You didn't answer that question. So how are you receiving the signal?

Im not looking at the recieving side.

soooo, how are you checking if it works or not? Sounds like testing the light switch, but without looking at the actual light, if it really lights up.

If the TV turns on then it works :/

if (Status=1) is an assignement, this will not work like you think it does. It should be a comparison: if (Status==1). Likewise for while (Status=2) and other if() and while() statements in your code. Furthermore there is no way your while() { } loops will ever exit because the value of  Status never changes inside the loop.

If the TV turns on then it works ... they are not all same ... what is the brand name and model of TV?

There are two basic things wrong here - one with your understanding of the timings, and the other with your understanding of how IR communication works.
First the timings - those are both ON and OFF timings. You don't just turn on for a defined length of time - you turn on for a defined length of time and then turn off for another defined length of time.
So for the timings in your code 4507,4507,573,1694,573,...etc... you would:

Turn on
Wait 4507us
Turn off
Wait 4507us
Turn on
Wait 573us
Turn off
Wait 1694us
Turn on
Wait 573us
... etc ...

You have no "off" time in your code, only ever on times.
Secondly is your understanding of IR communications. It does not involve turning an LED on or off for defined times. It's not as simple as that. Instead you are controlling the modulation of an LED.  When the LED of an IR remote control is "on" it's not just turned on - it's rapidly turning on and off. The receiver looks for the presence or absence of this rapid turning on and off light. This is the "carrier frequency" of the signal and must match what the receiver is looking for.
Typically this is between 30kHz and 50kHz depending on the receiver.
So you need some way of generating that rapid on-off signal. Normally this is done using PWM by the IR libraries and switching between 0% and 50% duty cycle for the off and on periods of the signal you want to send.
So it's far simpler to just use a library that does all this underlying work for you.

Thanks I will try this out and see if it works <3

I have edited my question because yours should work but it doesn't.

You have covered the first problem, but done nothing at all about the second problem.

delayMicroseconds(26) is 38khz :/

This I can 100% verify I know since it has been mentioned in all of the stuff I have read

Except for some problems: 1. digitalWrite and while take time so your 38kHz would end up more like 10kHz if you're lucky. 2. You have no way of ever leaving your while loop. 3. You are doing an assignment and not a comparison, which will always be true.

can you provide me some basic simplified code on wat i need to do? :>

if (Status==2) is an comparison, if (Status=2) is an assignment.

Yes: use a library. You are trying to perform something very very complex and you don't even understand the basic syntax of the library.

I mean I can use the library. I just want to understand how it works and I want to make my own simplified version. Satisfaction of doing it urself and just more flexible since its small and I can read it better and not only that improve its performance even if its at a fraction.

Start with doing something simpler. IR requires precise timing and an intimate knowledge of the MCUs internals.

oki :~ thanks :>


text:
Mega 2560 does not play audio file when I want. It plays when the first condition is met, but not the other

Okay, so I am making a jewelry box for my niece that will spin a necklace holder with a stepper motor, play an audio file and turn on LED lights. I am using an Arduino MEGA 2560.
The flow is this:

ringDoor open and necklaceDoor closed: LED on, stepper spin, audio plays.
ringDoor closed and necklaceDoor open: LED on and audio plays, no stepper
motor.
Both doors closed: Everything off or off after delay.
Both doors open: LED on and music plays, no stepper motor.

My issue is that with the doorLatch open, the audio plays as it should. No issues, but if I only open doorLatch2, no audio plays. If I open doorLatch and then doorLatch2, audio will play. If I open in reverse, no audio will play. I have tried adding an if statement by itself with an "or" in the loop section to check for either door open and I cannot put it in the setup section because that just continuously plays with latches open or closed. I currently have it to where music plays with doorLatch open. The extremely strange portion to me is that if I put the tmrpcm.play in the first else statement, the audio will play after opening and closing doorLatch2.
So what I would like is for audio to play and loop as long as either door is open. PLEASE HELP! WHAT AM I DOING WRONG?!?!?!?!?!
Code:
#include <SD.h>
#include <TMRpcm.h>
TMRpcm tmrpcm;

#include <Stepper.h>
const int stepsPerRevolution = 2048;
const int doorLatch=2;   //Ring door
const int doorLatch2=6;  //Necklace door
const int relayPower=13; //Turn relay on

Stepper myStepper = Stepper(stepsPerRevolution, 8, 10, 9, 11);

void setup() {
  Serial.begin(9600);
  Serial.print("\nInitializing SD card...");

  // set this to your card type and cs pin
  if (!SD.begin(53)) {
    Serial.println("failed!");
    return;
  }
  Serial.println("done.");

  tmrpcm.speakerPin = 46;

  myStepper.setSpeed(5);
  pinMode(doorLatch,INPUT);
  pinMode(doorLatch2,INPUT);
  pinMode(relayPower,OUTPUT);
  digitalWrite(doorLatch,HIGH);
  digitalWrite(doorLatch2,HIGH);

}

void loop() {

  if ((digitalRead(doorLatch)==HIGH)&&(digitalRead(doorLatch2)==HIGH)) {
    //ring door and necklace door is closed
    digitalWrite(relayPower,LOW);

  }
  else {
    //ring door is open, lights on, stepper motor spinning, music playing
    digitalWrite(relayPower,HIGH);

  }

  if ((digitalRead(doorLatch2)==HIGH)&&(digitalRead(doorLatch)==LOW)) {
    //ring door open and necklace door closed

    digitalWrite(relayPower,HIGH);

    myStepper.step(stepsPerRevolution);
    delay(500);
    myStepper.step(-stepsPerRevolution);
    delay(500);

  }
  else {
    tmrpcm.play("music.wav");
  }
}

NEW CODE, NEW PROBLEM, but closerUpdated names and notes for easier following***
New problem is if I open the necklaceDoor first, nothing happens. I have to open the ringDoor first. That turns everything on. Then with the necklaceDoor open, the stepper motor will turn off and the lights and music will continue to play. But I want to be able to open the necklaceDoor first and play the music with the lights. I do not want it to matter which one is opened first. I also realized that if I can get an or statement to work within an and statement I could do away with the fourth if statement completely. Both ringDoor open and necklaceDoor open, as well as ringDoor closed and necklaceDoor open have the same outcome.
Now if I switch the door states in the third if statement, I get necklaceDoor only plays audio after closed(original problem) but if both doors are open and then ringDoor is closed, the music will shut off after the stepper timer is done and then start again after necklaceDoor is closed?!?!?!?
#include <SD.h>
#include <TMRpcm.h>
#include <Stepper.h>
TMRpcm tmrpcm;

const int stepsPerRevolution = 2048;   //Number of pulses per revolution
const int ringDoor=2;                  //Ring door
const int necklaceDoor=7;              //Necklace door
const int relayPower=22;               //Turn relay on

Stepper myStepper = Stepper(stepsPerRevolution, 8, 10, 9, 11);

void setup() {
  Serial.begin(9600);                         //Start connection with computer

  if (!SD.begin(53))                         //Chip pin on card
  {
    Serial.println("failed!");                //SD card did not read
    return;
  }

  tmrpcm.speakerPin = 46;                      //Speaker output pin
  myStepper.setSpeed(5);                       //Stepper speed
  pinMode(ringDoor,INPUT);                     //Check state of ring door magnetic switch, NO
  pinMode(necklaceDoor,INPUT);                 //Check state of necklace door magnetic switch, NO
  pinMode(relayPower,OUTPUT);                  //Relay enable for 12V LED
  digitalWrite(ringDoor,HIGH);                 //Make door closed read high on start up
  digitalWrite(necklaceDoor,HIGH);             //Make door closed read high on start up
  digitalWrite(relayPower,LOW);                //Make relay off on start up
}

void loop() {

  if ((digitalRead(ringDoor)==HIGH)&&(digitalRead(necklaceDoor)==HIGH))
  {                                                                                //ring door and necklace door is closed, everything is off
    digitalWrite(relayPower,LOW);
  }

  if ((digitalRead(ringDoor)==LOW)&&(digitalRead(necklaceDoor)==HIGH))
  {                                                                                //ring door is open and necklace door is closed, lights on, stepper motor spinning, music playing
    digitalWrite(relayPower,HIGH);
    tmrpcm.play("music.wav");
    myStepper.step(stepsPerRevolution);
    delay(500);
    myStepper.step(-stepsPerRevolution);
    delay(500);
  }

  if ((digitalRead(ringDoor)==HIGH)&&(digitalRead(necklaceDoor)==LOW))
  {                                                                                //ring door closed and necklace door open, lights on, stepper motor off, music playing
    digitalWrite(relayPower,HIGH);
    tmrpcm.play("music.wav");
  }

  if ((digitalRead(ringDoor)==LOW)&&(digitalRead(necklaceDoor)==LOW))
  {                                                                                //ring door and necklace door open, lights on, stepper motor off, music playing
    digitalWrite(relayPower,HIGH);
    tmrpcm.play("music.wav");
  }
}

Please and thank you to any and all who help. It is greatly appreciated

couple of things ... use descriptive variable names ... use ringDoor instead of doorLatch, similar for the other door .... draw a chart of behavior ... it is either door -> led & sound ... ring door -> motor

Your code doesn't match your desired output. You say you want to:
doorLatch open and doorLatch2 closed: LED on, stepper spin, audio plays.
doorLatch closed and doorLatch2: LED on and audio plays, no stepper motor.
Both latches closed: Everything off or off after delay.
Both latches open: LED on and music plays, no stepper motor.

Note that both latches open and and doorLatch closed  DoorLatch2 open result in the same state: LED on and audio plays, no stepper motor.
Your code says
if doorLatch & doorLatch2 are both closed (high)

    relayPower = low (off)

else

    relayPower = HIGH (on). This in ALL cases other than both latches HIGH

Next, a second if statement:
if doorLatch2 == HIGH && doorLatch == LOW
     relayPower = HIGH (on)
     step motor back and forth
else
     play sound

So you play the sound if doorlatch2 is low or doorLatch is high
You turn off the relay if doorLatch & doorLatch2 are both closed (high)
You turn on the relay if doorLatch is low or doorlatch2 is low.
void loop() {
   int latchState digitalRead(doorLatch);
   int latch2state = digitalRead(doorLatch2);
   if (latchState = LOW && latch2Sate == HIGH) {        //0 - 1
      //turn on led
      //spin stepper
      //play audio
   } else if (latchState = HIGH && latch2Sate == LOW) { //1 - 0
      //Turn LED on
      //play audio
      //turn off stepper
   } else if (latchState = HIGH && latch2Sate == HIGH) {//1 - 1
     //turn everything off (after delay?)
   } else if (latchState = LOW && latch2Sate == LOW {   //0 - 0
     //LED on
     //play music
     //turn off stepper
   }
}

I tried that and my relay pin stayed energized the entire time. I have redone a little bit and will edit original post

I solved the same problem for a friend a long time ago. Maybe that's the same case: there were a interrupt conflict between the stepper and the player. The way to solve is to reinit the player each time you want to play, so it wil re-install it's interrupt..


text:
Message parsing from MQTT server
I'm making a NodeMCU based home automation. I adapted code I found on internet for controlling a device (say LED) via MQTT broker hosted on a Raspberry Pi. It works fine. But when I try to scale it up for more than one device, I'm hitting a wall.
void callback(char* topic, byte* payload, unsigned int length)
{

  const char* t_bedroom_light1 = "/home/bedroom/light1";

  Serial.print("Topic from MQTT broker is : ");
  Serial.print(topic);
  char p = payload[0];

  // if MQTT comes a 0 turn OFF pin D4
  if (topic == "/home/bedroom/light1" && p == '0')
  {
    digitalWrite(LIGHT_PIN, LOW);
    Serial.println(" Turn Light Off! ");
  }

  // if MQTT comes a 1, turn ON pin D4
  if (topic == "/home/bedroom/light1" && p == '1')
  {
    digitalWrite(LIGHT_PIN, HIGH);
    Serial.println(" Turn Light On! " );
  }
}

Serial monitor receives and prints the topic correctly from MQTT server. But topic == "/home/bedroom/light1" never returns true. If I delete that part then p =='0' or p=='1' works fine by itself. I've tried comparing the topic with the locally declared char array, tried converting it into String and doing strcmp. Nothing. What am I doing wrong? Here is the Serial monitor output
12:43:20.346 -> .......
12:43:24.187 -> WiFi connected
12:43:24.187 -> IP address:
12:43:24.187 -> 192.168.1.5
12:43:24.187 -> Attempting MQTT connection...connected
12:43:30.752 -> Topic from MQTT broker is : /home/bedroom/light1

That's not how you compare C strings.
When you write
if (topic == "/home/bedroom/light1")

you're comparing whether the character pointer topic is the same value as the address of the string "/home/bedroom/light1", which of course it is not in this case.
To compare C strings, use the strcmp() function, which returns 0 if they're identical.
if (strcmp(topic, "/home/bedroom/light1") == 0 && p == '0')

Ty, that worked! The noob in me didn't know char arrays were Strings. I had actually tried casting the char array to a new String and used strcmp on that but for some reasons that didn't work.

Actually, char arrays are not Strings (note the capital S), but c-strings, which is a significant difference. Strings shouldonly not be used in devices, with limited memory (or only verys sparingly) while c-strings (char arrays) do not exhibit the same problems.

What @StarCat said. Unfortunately C strings also let you shoot yourself in the foot very easily. It's definitely one of the less intuitive parts of C unless you're coming to C from assembly language programming :)