Arduino Emulation on PC

I have worked on this for a while and was able to run arduino code on my PC. This is to make debugging much easier and compiling much faster (1 second compared with minutes of compile and upload). Since the purpose was to develop phi_prompt programs, I only made emulations on key Arduino functions, liquidcrystal, DS1307, phi_interface, and phi_prompt libraries. There are no real hardware hooked up to arduino. Future development may include some limited feature such as digitalWrite or other hardware that I might need for projects. Here are some pictures to accompany my previous post about the professional development kit for phi_prompt:

The supported Arduino stuff is here:

microSeconds(); //Good luck with this on a multitasking operating system!

PROGMEM related definitions and functions. Seems to be working with “c-strings in PROGMEM and a pointer array in PROGMEM to point to these strings”. I have not tested other data types. Be careful with this though, pitfalls may still exist
strlcpy(); // This is only available with GNU C not a standard one but I need it.

LiquidCrystal library. Will work on write(char), print(int) and print(float)

Everything except for below functions, which I don’t use
        void noDisplay();                                                         ///< Turns off the display
        void display();                                                           ///< Turn on the display
        void scrollDisplayLeft(); // Hate these scroll functions. Useless
        void scrollDisplayRight();
        void leftToRight();
        void rightToLeft();
        void autoscroll();
        void noAutoscroll();
        void createChar(uint8_t, unit8_t*); // I can’t create char on PC

DS1307 all working except for this one I didn’t implement. Easy to do though. Also start and stop have no actions. You can’t change DOW without changing dates.
    int get(int, boolean);

phi_interfaces input device library only has the phi_serial_keypads class which takes inputs from keyboard. Function keys are wsadfg of course (who didn’t play some FPS games?)

phi_prompt user interface library works except that the right arrow looks different and the scroll bar is not as awesome as on real LCD

6 Responses to Arduino Emulation on PC

  1. jeroendoggen says:

    Nice work!

    From your screenshot, I assume that you are using Dev-C++?
    Did you implement this in standard C++ or using some GUI toolkit?
    Are you using Mingw to produce a win32 executable?
    Is it possible to provide the source code?

    Some similar/related projects:

    • liudr says:

      Yes I am using Dev C++. I just used windows console application, and then use some standard window calls to move cursor around. I then re-sized the screen to only display 20*4 characters 😉
      I’m not sure what Mingw is (can you explain here?).

      I might be able to provide the source code since you sound like you may know more about Dev C++ than I do. I just don’t want newbies try this and get stuck and ask me the impossible question of how to do it. I expect some level of experience in programming. I’m ultimately going to provide service to this simulation not for free since this simulation is intended for someone trying to make user interface for their products.

  2. Hubert Chen says:

    Dear liudr,
    This is Hubert Chen, I am the founder of Village Tronic. We are developing an open source high speed, high power connection standard for PC – Box connections called C². Kind of like Thunderbolt, but faster, lower cost and open source. As part of the open source projects we will offer complete design and manufacturing kits. The Micro-controller part is based on the Atmel ATmega / ATtiny. The development Environment is Arduino. All projects I am listing below are open source. Schematics and PCBs are made with Eagle, Microcode with Arduino:
    C²Nano Terminal, 6 keys, 1602 Display
    C²Micro Terminal, 12 keys Pad, 2004 Display

    The Terminals are used in boxes for User Interaction and are connected via Serial. We have very complete manufacturing capabilities from connectors, cables, housings, PCBs to completely finished products. We are new to Arduino community and are looking for ways to contribute.

    Let me know what you think. Our project is still in its infancy, but I made an introduction write up on our facebook page.

    Best Regards,
    Hubert Chen

    • liudr says:


      That’s very interesting. So the terminal has basically a human-machine interface (HMI) and the HMI connects to the real computer so a user can control it and show settings? I think that my phi-panel would be perfect for this purpose. It speaks ansi so you can control it pretty much like a terminal. It also has multi-tap. I got your email. I’ll write a reply in a day or two. I’m in the middle of grading final exams 🙂

      • Hubert Chen says:

        Dear liudr,
        Thank you for your swift response. We want to use offer the user the choice to control the box via Serial Port / USB connection or stand alone. I agree your phi-panel SW would be perfect and I am very excited to hear from you by email. Meanwhile I would love to play with your SW. I have ordered a Phi-Panel board with you. Where are you located? We are in Guangzhou China. Is international shipping a problem? Should we pay more money? What is the fastest way for me to get my hands on phi-panel? Is there a way to buy it locally?

      • liudr says:


        Email sent. Let me know what you want so I can ship you the right kit. Right now you didn’t order the panel but a shield instead.

Leave a Reply