Go Down

Topic: console output? (Read 614 times) previous topic - next topic

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?

pYro_65

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.

UKHeliBob

To answer your first 2 questions
Code: [Select]
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.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

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... :)

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

UKHeliBob


my board is now busy taking pictures...

It could also be doing other things whilst it waits.  Such a waste.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

liudr

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

PaulS

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?

robtillaart

Enough memory and CPU to learn important basics about multi-tasking and ISR()'s an other OS details imho ;)
Rob Tillaart

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



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

UKHeliBob

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.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Docedison

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

Bob
--> 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

UKHeliBob

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.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up