Pages: [1]   Go Down
Author Topic: console output?  (Read 512 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi.  Very new here.
Would like to know how I can output messages to the console.
Also what is the sizeof(int)?
I am trying to use delay to wait for x amount of time (in milliseconds) and if its greater than 65535 then going to wrap around?
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 70
Posts: 2171
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The serial library is what you want, it can send data to the IDE serial monitor.

Int is 16 bits. and 65K is the range for an unsigned int, not a ( signed ) int.
Logged


East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4261
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To answer your first 2 questions
Code:
unsigned int example = 65535;

void setup()
{
  Serial.begin(9600);
  Serial.print("The example unsigned int is : ");
  Serial.println(example);
  Serial.print("Size of unsigned int = ");
  Serial.println(sizeof(example));
}

void loop()
{
}

To see the output turn on the serial monitor in the IDE (top/right) after compiling and uploading the code.

delay is defined as

"Syntax delay(ms)
Parameters ms: the number of milliseconds to pause (unsigned long)"
So 65535 is not going to bother it at all. 
How long are you going to delay and why ?  There is almost certainly a better way of doing it.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the Serial tip!

I wish I had a simulator... Cause my board is now busy taking pictures...
Yes I think there are better ways, but I only have on task that that is to fire the timer every 90 seconds.

I think I'm going to do a lot with these little devices... So I think learning a bit about multi-tasking and interrupt service routines (yet again).....

Gotta get a touch screen interface... smiley

HDMI might have been another option for controlling my camera...
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4261
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

my board is now busy taking pictures...
It could also be doing other things whilst it waits.  Such a waste.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7198
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep, read the blink without delay example code in Arduino. A touch screen will need a lot of resources so the simpler the better.
Logged


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

Quote
So I think learning a bit about multi-tasking and interrupt service routines (yet again).....
Perhaps even threading. Yep. the no-operating system Arduino is perfect for multi-tasking and threading. It's got memory and processor speed to spare. Doesn't it?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13739
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Enough memory and CPU to learn important basics about multi-tasking and ISR()'s an other OS details imho smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

my board is now busy taking pictures...
It could also be doing other things whilst it waits.  Such a waste.

Well I can't program it and have it next to me while it's busy doing what I programmed it to do...
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4261
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Buy a second one.
Come on. you know you want to !

Actually, I was referring to the waste of having it sitting around for 90 seconds at a time not able to do anything else (even if were right next to you), then just clicking a shutter, which is what I imagine it is doing.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2892
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Stoopid question but what else could the controller be doing? besides waiting, it's a shutter timer, isn't it?...

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4261
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Logging changing light levels, detecting movement, tracking the movement, monitoring battery charge, calculating the value of Pi, sending information back to base via WiFi, tweet or web page update, acting as a burglar alarm, etc etc.  Basically anything that an Arduino could be doing in that location regardless of whether it is related to the camera.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pages: [1]   Go Up
Jump to: