2 Replies Latest reply on May 3, 2016 10:44 PM by Lane_Lee

    Can i use system("XXX") to send a command "XXX" to Edison

    Lane_Lee

      Before, I succeeded in sending a "reboot" command to edison by write system("reboot") to Edison in Arduino IDE, and it works very well. Now I want him to perform one command like this "configure_edison - -wifi" , just like that I write in putty. I also write system("configure_edison - -wifi" ),  but it seems not working. So I wonder how can I give him that command.

       

      PS: My Edison is a little naughty, it could connect wireless-router wifi automatically with no problem. Now in my project,  I need him to connect campus wifi automatically (ssid; then username, password),  but it's instable, I need to reboot several times to auto-connect. Recently I note that everytime I write the command "configure_edison - -wifi" and presse Enter in putty, it will auto-connect campus wifi before I input the username and password. So my edison must have remmembered the relevant username and password.


      So I want to do in this way to make sure my edison will auto-connect campus wifi. By the way, my image is 146. And I am using Arduino expasion board.


      Pls help, Thanks,

      I know it's not a good choice to program in Arduino IDE, but I almost have no time left in my project. After that, I will learn more on Linux and mraa, etc.

      Thanks again,

      Lane

        • 1. Re: Can i use system("XXX") to send a command "XXX" to Edison
          DiegoV_Intel

          Hi Lane_Lee,

           

          I tested the command "configure_edison --wifi" and it works when running it from the Arduino IDE. You can test it by adding the following line in your Arduino sketch: system("configure_edison --wifi > /dev/ttyGS0");

           

          The command above will display the results in the Serial Monitor. However, you will notice that you are not able to select the network desired from the network list. This command is not appropriate because there is no way to submit values from the Arduino IDE. In this case, the command runs fine, but you cannot interact with it in order to enter additional data.

           

          If you need to restart the WiFi interface, then the following command might work: "systemctl restart wpa_supplicant". You can run it from the Arduino IDE by adding the following line in the Arduino sketch: system("systemctl restart wpa_supplicant");

           

          The command above restarts the WiFi connection. If you have entered the network credentials when running the command configure_edison --wifi before, then your Edison should connect automatically to the same network.

           

          Regards,

          Diego

          • 2. Re: Can i use system("XXX") to send a command "XXX" to Edison
            Lane_Lee

            Hi, DiegoV,

            Thanks for your info. It worked!!

            I added this command "system("systemctl restart wpa_supplicant") " to my code. Everytime it lose connection with web server, it will restart the WiFi. Now I am very happy.

            Thanks,

            Lane