Go Down

Topic: Beginning Arduino; Some Basic Questions (Read 707 times) previous topic - next topic

Tobias_Funke

I just purchased an Arduino Duemilanove ATOmega 328, and while I have a decent amount of programming experience, I have never used Java (that is the language that you program with in the GUI, correct?)

Anyway, one of my questions is probably a very simple fix, but I was wondering how do I stop a program from running? I have tried the 'Blink' and the 'Fade' programs in the Examples area, and there does not seem to be a way to stop them from running; I click the 'Stop' button at the top of the page, but the program continues to run. Even when I unplug the power cord, the program continues running once I plug the power back into the board.

Also, when I was running the 'Fade' program, I wanted to see output of the values of a variable, but nothing printed. I used the Serial.print() function, although that is probably not the correct one to use. I expected to see something in the black text region below the code for the program on the GUI, but I'm assuming that Serial.print() will output to a serial port, which is not what I was looking for. Is there a way to read a text output of a program if I use the correct function?

Thank you for your help.

AlphaBeta

You program the Arduino in C++ (a superset of a subset) and the editor you write the Arduino code in, that is written in Java.

To 'stop a program' you simply enter an infinite loop (or a loop that you can break out from when you decide).
Code: [Select]

void haltProgram() {
 while (true) {}
}

A call to haltProgram() will seemingly stop the execution, but the CPU will execute a No OPeration for ever.

johnwasser

You click on the Serial Monitor button at the top of the sketch (to the right of the Download button) to open a simple terminal window to see your Serial.print() output. 
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

PaulS


You click on the Serial Monitor button at the top of the sketch (to the right of the Download button) to open a simple terminal window to see your Serial.print() output. 

Presuming you have a Serial.begin() statement in setup() to got with your Serial.print() and Serial.println() statements.

Go Up