Pages: [1]   Go Down
Author Topic: Beginning Arduino; Some Basic Questions  (Read 678 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Norway@Oslo
Offline Offline
Edison Member
*
Karma: 13
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
void haltProgram() {
  while (true) {}
}
A call to haltProgram() will seemingly stop the execution, but the CPU will execute a No OPeration for ever.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8966
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 635
Posts: 50263
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: