Electron doesn't seem to respond to Serial input

electron
Tags: #<Tag:0x00007fe21da41210>

#1

I’m trying to allow users to set the APN and keepAlive for a 3rd-party SIM card; however, the trip up has been at accepting user input over Serial.

It seems like there is never data available over Serial despite clearly entering data. I have set up the serial connection and then try something like:

while (Serial.available()) {
        Serial.println("looking");

        serialData = Serial.read();
        switch(serialData) {
          Serial.println(serialData);
          case 'A':
          case 'a':
            Serial.println("Enter the APN: ");
            STATE = ENTER_APN_STATE;
            inputBufferOffset = 0;
            break;
          
          case 'K':
          case 'k':
            Serial.println("Enter the keepAlive value in seconds: ");
            STATE = ENTER_KEEP_ALIVE_STATE;
            inputBufferOffset = 0;
            break;
          
          case 'C':
          case 'c':
            Serial.println("Starting the carrier report...");
            STATE = TOWER_REPORT_STATE;
            stateTime = millis();
            break;

          case 'D':
          case 'd':
            Serial.println("Printing out EEPROM vars: ");
            STATE = EEPROM_DATA_STATE;
            stateTime = millis();
            break;
          
          case '\r':
          case '\n':
            STATE = MENU_STATE;
            break;
        }
      }

Everything is set up pretty much identical to @rickkas7 clouddebug library. In fact, if I flash the firmware for his library (clouddebug), I experience the same issue - I can’t ever enter in an option for the menu.

I am using os 1.2.1 on an Electron. What are some debugging measures I can take?


#2

What tool are you using to send the data to the device.
Are you using a non-AUTOMATIC system mode and/or SYSTEM_THREAD(ENABLED)?
Can you try a really minimal test sketch that only catches the input and mirrors it back as it comes in?


#3

What ScruffR said. Make sure you’re not using particle serial monitor because that’s really only a monitor - you can’t type commands to the device into it.


#4

Yea, I was just about to delete the question, ha. I’m pretty sure it is what @rickkas7 suggested. I was using particle serial monitor without thinking about it. Should probably sleep before posting questions…

Is there a recommended vscode extension for a serial monitor that supports input? Pretty sure that functionality was lost between the Atom-based IDE and the current vscode-based one?