Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Re: uploading takes forever on: August 14, 2011, 02:12:15 pm
First off all, thanks for the reply!!!

I'm uploading to an Arduino Mega 2560 using v0022 on windows 7 x64

This is my test code:
Code:
/* SD card read/write
 The circuit:
 * SD card attached to SPI bus as follows:
 ** MOSI - DI
 ** MISO - DO
 ** SCK - CLK
 ** SS - should always be OUTPUT
*/
 
#include <SD.h>

File myFile;

int CS = 30;
int SS = 53;

#include <MomentaryButton.h>

#define PIN_BUTTON1 2
MomentaryButton button1(PIN_BUTTON1);

#define PIN_BUTTON2 3
MomentaryButton button2(PIN_BUTTON2);

void setup()
{
SetupSDcard();
  
button1.setup(); // set as INPUT, set HIGH
button2.setup(); // set as INPUT, set HIGH
}

void loop()
{
CheckButtonClicks();
}


void SetupSDcard() {
pinMode(SS, OUTPUT);
Serial.begin(9600);
Serial.print("Initializing SD card...");
// Note that even if it's not used as the CS pin, the hardware SS pin should be set to OUTPUT
pinMode(CS, OUTPUT);
  
if (!SD.begin(CS)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
}

void CheckButtonClicks() {
button1.check();
if (button1.wasClicked()) {
// Respond to the button being briefly closed, then released.
Serial.println("Button1 was clicked");
WriteFile("piet.txt","my line of text");
}
  
    button2.check();
if (button2.wasClicked()) {
// Respond to the button being briefly closed, then released.
Serial.println("Button2 was clicked");
ReadFile("piet.txt");
}  
}

void WriteFile(char Filename[ ], char TextLine[ ])
{
// open the file. note that only one file can be open at a time,
//so you have to close this one before opening another.
myFile = SD.open(Filename, FILE_WRITE);
  
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to ");Serial.print(Filename);Serial.println("...");
myFile.println(TextLine);

// close the file:
myFile.close();
Serial.println("done.");
}
else {
// if the file didn't open, print an error:
Serial.print("error opening ");Serial.println(Filename);
}
}

void ReadFile(char Filename[ ])
{
// re-open the file for reading:
myFile = SD.open(Filename);
if (myFile) {
Serial.print(Filename);Serial.println(":");

// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
}
else {
// if the file didn't open, print an error:
Serial.print("error opening ");Serial.println(Filename);
}
}
17  Using Arduino / Programming Questions / Re: uploading takes forever on: August 14, 2011, 07:02:19 am
after "forever" I get:
Code:
Binary sketch size: 13562 bytes (of a 258048 byte maximum)
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
18  Using Arduino / Programming Questions / uploading takes forever on: August 14, 2011, 06:58:22 am
If I use the function below the uploading of the pde takes a few seconds:
Code:
void WriteFile(char Filename[ ])
{
  myFile = SD.open(Filename, FILE_WRITE);
  if (myFile) {
    Serial.print("Writing to ");Serial.print(Filename);Serial.println("...");
    myFile.println("some line of text");
    myFile.close();
    Serial.println("done.");
  }
 else {
Serial.print("error opening ");Serial.println(Filename);
  }
}

But if I change the function as shown below the compiling is done in seconds but the uploading takes forever:
Code:
void WriteFile(char Filename[ ], char myTextLine[ ])
{
  myFile = SD.open(Filename, FILE_WRITE);
 
  if (myFile) {
    Serial.print("Writing to ");Serial.print(Filename);Serial.println("...");
    myFile.println(myTextLine);
    myFile.close();
    Serial.println("done.");
  }
 else {
Serial.print("error opening ");Serial.println(Filename);
  }
}

Can anyone tell me what I'm doing wrong!?

Best regards,

Alban
19  Using Arduino / Installation & Troubleshooting / Re: Arduino IDE opens last used file by default on: August 14, 2011, 02:51:25 am
Maybe I see a common factor.

I suspected that it had something to do with v22 but at the same time I switched from XP to 7.
If I read the above posts it seems that the XP users have it open a blank window and the 7 and Mac users open last file!?
20  Using Arduino / Installation & Troubleshooting / Arduino IDE opens last used file by default on: August 13, 2011, 10:18:15 am
Hi,

Ever since I updated to 00022 my Arduino IDE will open the last used file when it starts.
I usually use an external editor that opens the IDE with the filepath of the file I want to upload as startup argument.
Always worked fine for me but now the IDE always opens twice, once with the last used file and once with my desired file.
Maybe someone can tell me if it is possible to disable this apparently new feature???

2nd question, I never bothered looking into it but I wondered if it is possible to automaticly upload using a startup argument for the Arduino IDE?

Best regards,

Alban

www.reptile-addict.nl/arduino
21  Using Arduino / Networking, Protocols, and Devices / Re: connect multiple arduinos by rf on: August 13, 2011, 05:27:00 am
have you seen the jeenode?
http://jeelabs.net/projects/hardware/wiki/JeeNode
It communicates thru RF.
Not sure if it will be usefull for you.

Best regards Alban
22  Using Arduino / Displays / Re: GLCD library version 3 on: June 15, 2011, 08:17:09 am
What happened to the "Pinout D panels" that were described on http://www.arduino.cc/playground/Code/GLCDks0108??
I have the same display as described on http://www.mcselec.com/index.php?option=com_content&task=view&id=189&Itemid=57 and was trying to hook it up to de V3 GLCD library.
Any ideas???
Pages: 1 [2]