Go Down

Topic: Arduino uno not printing messages in setup() (Read 528 times) previous topic - next topic

vima

Feb 12, 2013, 08:34 pm Last Edit: Feb 12, 2013, 08:37 pm by vima Reason: 1
Hello,

my program was working normally until yesterday. Then I add some arrays in the program, changed nothing in the setup but I cannot even see the messages in setup.

Here are what I added, and my setup function which is the same as before:

Code: [Select]

char* responses_array[]={
 "80","81","82"};

char* alive_array[]={
 "75","76","77"};

char* responses_to_wait[NUMBER_OF_BODIES];
char* alive_to_wait[NUMBER_OF_BODIES];

int positions[NUMBER_OF_BODIES];

int bodies_to_send_to[NUMBER_OF_BODIES];

void setup()
{
 Serial.begin(57600);

 Serial.println( "Arduino started sending bytes via XBee Vol.2" );

 // set the data rate for the SoftwareSerial port
 xbee.begin(9600);

 lcd.begin(16,2);              // columns, rows.  use 16,2 for a 16x2 LCD, etc.
 lcd.clear();                  // start with a blank screen
 lcd.setCursor(0,0);           // set cursor to column 0, row 0 (the first row)
 lcd.print(upRow);    // change this text to whatever you like. keep it clean.
 lcd.setCursor(0,1);           // set cursor to column 0, row 1
 lcd.print(bottomRow);

 for(int i=0;i<NUMBER_OF_BODIES;i++){
   positions[i]=0;
   Serial.print("Setting position at 0:  ");
   Serial.print(i);
 }
 Serial.println(" ");
 
}



in the Serial I see something like this:

Code: [Select]
¬Hø¬Hø¬Hø¬Hø¬Hø¬HøÔ
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
¬Hø¬Hø¬Hø¬Hø¬Hø¬HøÔ
Ô
¬Hø¬Hø¬Hø¬HøÔ
Ô
Ô
Ô
Ô
¬Hø¬Hø¬Hø¬Hø¬Hø¬HøÔ
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
Ô
¬Hø¬Hø¬Hø¬Hø¬Hø¬HøÔ


I have tried with two different arduino UNO, and cables but still nothing.

When I upload the program, TX and RX blink at the same time, and then TX blinks so fast.

As I remember before, TX was not blinking that fast.

If I run the last code, it runs without any problem.

KeithRB

This isn't your whole code. What is the value of NUMBER_OF_BODIES?

You might be running out of RAM, you may want to store the strings in flash.

vima


This isn't your whole code. What is the value of NUMBER_OF_BODIES?

You might be running out of RAM, you may want to store the strings in flash.


Yes I have told you that this is now my whole code. It is just the new variables I added.

What do you mean in flash? Can you give me any example of this?

How much memory does arduino have?

retrolefty



This isn't your whole code. What is the value of NUMBER_OF_BODIES?

You might be running out of RAM, you may want to store the strings in flash.


Yes I have told you that this is now my whole code. It is just the new variables I added.

What do you mean in flash? Can you give me any example of this?

How much memory does arduino have?


Uno has:
About 30 Kbytes of FLASH memory for code space, but only 2 Kbytes of SRAM space for all your variables, arrays, const, String constants, stack space, heap space, etc in SRAM memory.
Other Arduino boards have different amounts of both types of memory.
Lefty

KeithRB

I don't see a definition (or #define) for NUMBER_OF_BODIES, what is its value?

PaulS

Quote
Yes I have told you that this is now my whole code. It is just the new variables I added.

It can't be, as it doesn't even compile. Where is NUMBER_OF_BODIES defined and valued?

UKHeliBob

What baud rate is the serial monitor set to ?
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