title: How to communicate with sim800c using Raspberry pi 3 in c++
body: <p>My end goal is to try and send some simple data that's stored on my Raspberry pi 3 to an external server/website using a sim800c from a c++ program. I believe the easiest way to do this is to issue "AT commands" to the sim/modem however I'm struggling to do this. I can't figure out how I'm actually suppose to issue AT commands or how I can check if they're working. For testing purposes I've written some code which should send a text message to a phone number once I've gotten this working it should be fairly straight forward to figure out the AT commands to communicate with a server.</p>
  
  <p>Below is an image of how I've wired everything up which I'm fairly confident is correct.</p>
  
  <p><a href="https://i.imgur.com/zysmNXE.jpg" rel="nofollow noreferrer">https://i.imgur.com/zysmNXE.jpg</a></p>
  
  <p>Below is the basic c++ code that I've written using various guides, it compiles and runs in terminal however I don't get any response from the AT commands and more importantly as far as I can tell their not actually being executed. I've tried changing the fake number to my personal one but it didn't make a difference.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;wiringPi.h&gt;
  #include &lt;wiringSerial.h&gt;
  
  int main ()
  {  
  
      int connection;
  
      printf("Opening connection \n");
      connection = serialOpen("/dev/ttyAMA0", 9600);
      delay(1000);
      printf("Connection:  %d\n", connection);
      printf("\n");
  
      //Set gsm to text mode
      serialPuts(connection,"AT+CMGF \r\n");
      delay(1000);
  
      //Number that the message should be sent to
      serialPuts(connection,"AT+CMGS=\"12345678900\"\r\n");
      delay(1000);
  
      //The message
      serialPuts(connection,"Hello World");
      delay(1000);
  
      //Print ctrl+x
      serialPuts(connection,"\x1A");
  
      delay(1000);
  
      printf("Done \n");
  
      return 0 ;
  }
  </code></pre>
  
  <p>As far as I can tell there are 3 likely reasons why it's not working; </p>
  
  <ul>
  <li>A possible config/settings issue with the pi</li>
  <li>I've wired it up incorrectly </li>
  <li>The sim/module isn't working</li>
  </ul>
  
  <p>I'm just not sure how to go about testing/finding what is causing the issue. If I could get my code to output the response of the AT commands after doing "serialPuts" that might help me figure out whats going on but I haven't made much luck doing that. Alternatively If anyone has an idea why the commands don't appear to be working or can provide me some ways to debug/test them that would be great.</p>