Jump to content
43oh

code stuck at the end of setup


Recommended Posts

Hi,

I am wondering why when I make the debug using  CCS, the code at the end of the setup opens a new window with following code and stuck there, I do not have any serial function, I tried to send the data to the serial monitor but it fails so I created a new project without any serial monitor statements/function.

#include <Energia.h>

int main(void)
{
    init();

    setup();

    for (;;) {
        loop();
        if (serialEventRun) serialEventRun();
    }

    return 0;
}

 

Any help would be appreciated. 

Thanks

Link to post
Share on other sites

I'm not quie clear on your question, and at the risk that it's obvious...

for(;;) = loop forever

If your Engergia code has an empty loop(), and never does anything to generate a serial event, then it's going to be "stuck" in a loop that repeatedly checks for a serial event.

So, what's in your loop() code? What do you expect to see?

Link to post
Share on other sites

This code is the loop code from Energia's main(). init() set's up the chip, setup() is your setup() in the Sketch and then finally loop() is the loop code in your Sketch.

It will indeed loop forever calling SerialEventRun() and your loop(). If you do not have a SerialEvent installed by implementing void serialEvent() in your Sketch then it won't be called.

As @NurseBob mentioned, what is in your setup() and loop() code. Is it really stuck in setup() or is it halting within the for(;;){} piece of code.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...