//========================================

// CHello program

//========================================

component CHello(

    in  active ubyte iConsole,

    out active ubyte oConsole)

{

    // Constant string declaration

    const string cHelloWorld = "Hello World!\n";

 

    // Working memory, simulates CPU memory       

    ubyte memory

    {

        sHelloWorld[16]

    };

   

    //========================================

    //    ARDUINO setup() function

    //========================================

    setup()

        int i

    {

        // Need to copy constant string to memory

        i = 0;

        while(cHelloWorld[i] != 0 )

        {

            sHelloWorld[i] = cHelloWorld[i]; 

            i++;

        }

        return;

    }

    

    //========================================

    //    ARDUINO loop() function

    //========================================

    loop()

    {

        // Type any char to start

        while(!istrig(iConsole)) {};

       

        // Call puts() as in C++

        call puts(sHelloWorld);

       

        // As for Arduino, loops forever

        // Type another character to repeat

    }   

};