7 Replies Latest reply on Jan 4, 2017 4:10 PM by Intel Corporation

    How to Use c_str Replacement From DiegoV_Intel on Edison ARDUINO IDE

    jkkoverd

      I am trying to use the following code with my Edison and an SIM800l

       

      void setup() {

        // Set console baud rate

        SerialMon.begin(115200);

        delay(5000);

      }

       

      void loop() {

        // Detect module baud rate

        uint32_t rate = 0;

        uint32_t rates[] = { 115200, 9600, 57600, 19200, 74400, 74880 };

       

        SerialMon.println("Autodetecting baud rate");

        for (unsigned i = 0; i < sizeof(rates)/sizeof(rates[0]); i++) {

          SerialMon.print(String("Trying baud rate ") + rates[i] + "... ");

          SerialAT.begin(rates[i]);

          delay(10);

          if (modem.autoBaud(2000)) {

            rate = rates[i];

            SerialMon.println(F("OK"));

            break;

          } else {

            SerialMon.println(F("fail"));

          }

        }

       

        if (!rate) {

          SerialMon.println(F("***********************************************************"));

          SerialMon.println(F(" Module does not respond!"));

          SerialMon.println(F("   Check your Serial wiring"));

          SerialMon.println(F("   Check the module is correctly powered and turned on"));

          SerialMon.println(F("***********************************************************"));

          delay(30000L);

          return;

        }

       

        // Access AT commands from Serial Monitor

        SerialMon.println(F("***********************************************************"));

        SerialMon.println(F(" You can now send AT commands"));

        SerialMon.println(F(" Enter \"AT\" (without quotes), and you should see \"OK\""));

        SerialMon.println(F(" If it doesn't work, select \"Both NL & CR\" in Serial Monitor"));

        SerialMon.println(F("***********************************************************"));

       

        while(true) {

          if (SerialAT.available()) {

            SerialMon.write(SerialAT.read());

          }

          if (SerialMon.available()) {

            SerialAT.write(SerialMon.read());

          }

          delay(0);

        }

      }

      However, I get the following error:

      'class String' has no member named 'c_str'

       

      I have seen a possible solution from DiegoV_Intel here

      System Calls c_str and other String related stuff in ARDUINO IDE

      However, I am not very proficient in programming with Arduino and am unsure how to implement it.