2 Replies Latest reply on Dec 29, 2015 5:26 PM by Jordan1850

    Break out of a while loop with keystroke on Edison with C++ ?




      I would like the user of my program to be able to break out of a while loop be entering a keystroke.  I am aware of several methods of doing this: using kbhit from conio.h, multithreading with something like boost, and GetAsyncKeyState() from windows.h.  However, I have not been able to successfully implement these.  I'm wondering if the problem could be that I'm using a Windows 7 machine to write programs for the Intel Edison's Yocto Linux.  For instance, if I want to use the multithreading method should I download the boost header files for Linux and save it onto a file on my windows and then copy and paste the header path to my program?


      The following two images show my attempt at using the boost header:


      Edison Multi 1.PNGEdison Multi 2.PNG


      The following is the code that uses kbhit() from conio.h.  This won't compile.

      My do While loop.PNG

      My program is a homemade pulse width modulator for an H-bridge.  I was having issues with the pwm class so I made my own pwm function.