title: Serial interface initialisation with arduino and C
body: <p>I want to "talk" with my arduino using C on my mac. I first used the code in the link given on the arduino official website: <a href="http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/" rel="nofollow">http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/</a></p>
  
  <p>Using the "blink" example it simply doesn't work, I know that newer arduinos reset when the serial port is open but even with adding a delay (up to 4s) it simply blinks once whatever character I send. </p>
  
  <p>I also tried to change the code by disabling HUPCL (should prevent the reset) in the termios flags but it doesn't change anything.</p>
  
  <p>The <em>funny</em> thing is that it is working if I load the serial monitor of the Arduino official app in the background. The command screen is also fully functional. So I guess it has something to do with the initialisation of the serial communication. I then tried to get the flags (l, i, o and c) used by the monitor using <strong>stty -a</strong> and used them in my C program... without luck! </p>
  
  <p>Thanks for any help!</p>
  
  <p>PS: this is a chinese clone bought on ebay... maybe it can be relevant</p>
  
  <p>EDIT: I tried to use python to do the same thing with pyserial and it does the same: works only if the arduino app's serial monitor is running at the same time</p>