Show Posts
|
|
Pages: [1] 2 3 ... 13
|
|
1
|
Forum 2005-2010 (read only) / Troubleshooting / Using Arudino in Windows7
|
on: March 13, 2010, 01:56:41 am
|
|
hello everyone i have a upload problem with the Arduino Duemilanove ATmega168
when i tried to upload scripts, it is showing me like that
avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
|
|
|
|
|
5
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: SDcard library problem
|
on: June 12, 2010, 03:11:12 am
|
Help it is killing me here is my code #include <byteordering.h> #include <fat.h> #include <FAT16.h> #include <fat_config.h> #include <partition.h> #include <partition_config.h> #include <sd-reader_config.h> #include <sd_raw.h> #include <sd_raw_config.h>
FAT TestFile; //This will be the file we manipulate in the sketch char buffer[512]; //Data will be temporarily stored to this buffer before being written to the file int read_size=0; //Used as an indicator for how many characters are read from the file int count=0; //Miscellaneous variable
void setup() { Serial.begin(9600); //Initiate serial communication at 9600 bps
TestFile.initialize(); //Initialize the SD card and the FAT file system. Serial.println("Starting..."); TestFile.create_file("Sample.txt"); //Create a file on the SD card named "Read_File_Test.txt" //NOTE: This function will return a 0 value if it was unable to create the file. TestFile.open(); //Now that the file has been created, open it so we can write to it. }
void loop() { TestFile.write("This is test data."); //using the write function will always write to the beginning of the file. // Here we add some text to the file. TestFile.close(); //We are done writing to the file for now. Close it for later use.
while(1){ TestFile.open(); //Open the file. When the file is opened we will be looking at the beginning of the file. read_size=TestFile.read(buffer); //Read the contents of the file. This will only read the amount of data specified // by the size of 'buffer.'
Serial.println(read_size, DEC); //Print the number of characters read by the read function. for(int i=0; iSerial.print(buffer[i], BYTE); //Print out the contents of the buffer. } Serial.println();
sprintf(buffer, "%d", count++); //Now we'll use the buffer to write data back to the file. // Here's we'll only add one value to buffer, the 'count' variable. TestFile.write(buffer); //Write the new buffer to the end of the file TestFile.close(); //Close the file for later use.
delay(1000); //Wait one second before repeating the loop. } }
|
|
|
|
|
6
|
Forum 2005-2010 (read only) / Syntax & Programs / SDcard library problem
|
on: June 11, 2010, 01:19:49 am
|
Hello everyone i have a problem with the sdcard library i am using the fat16 and sd_raw library when i tried to compile the code, it showed me this E:\Arduino\arduino-0018\libraries\SDcard\arduino sd card example.cpp:161: error: 'DEC' was not declared in this scope how to declare the DEC in the library ? Thanks a lot
|
|
|
|
|
7
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Calculation problem "*"
|
on: June 17, 2010, 09:34:25 am
|
"unconnectedPin" is something you have to define. Hopefully, you'll have a spare analogue input. but i just want to print the value here's the situation i don't have any input, if i would like to print the value randomly between 400 and 500, is it possible to do it ? void setup() { Serial.begin(9600); } void loop() { int x = 2; double y = x * 10; if (y > 3) Serial.println("400" or "500"); // this is the value that i would like to print, 400 or 500, when the value of y is larger than 3.
}
|
|
|
|
|
10
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Calculation problem "*"
|
on: June 17, 2010, 07:55:45 am
|
|
How about this one
if ((x < 10) && ( x < 5)) Serial.println("400" || "500");
i would like to print the value randomly, sometimes 400 or 500
could this code on the above ?
and i have a problem with uploading the code when i uploaded a new code once, i attempted to uploade another one it told me that the usb port is being used, i can't upload again unless i restart the computer....
|
|
|
|
|
14
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: how to save data into the buffer?
|
on: June 13, 2010, 01:20:29 am
|
|
it is showing this error
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\SDcard/sd_raw_config.h:86:6: error: #error "no sd/mmc pin mapping available!"
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/fat.h:89: error: 'offset_t' does not name a type
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/fat.h:117: error: 'offset_t' does not name a type
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/fat.h:118: error: 'offset_t' does not name a type
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:83: error: typedef 'device_read_t' is initialized (use __typeof__ instead)
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:83: error: 'offset_t' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:83: error: expected primary-expression before '*' token
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:83: error: 'buffer' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:83: error: expected primary-expression before 'length'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:92: error: 'offset_t' has not been declared
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:111: error: typedef 'device_read_interval_t' is initialized (use __typeof__ instead)
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:111: error: 'offset_t' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:111: error: expected primary-expression before '*' token
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:111: error: 'buffer' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:111: error: expected primary-expression before 'interval'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:111: error: expected primary-expression before 'length'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:111: error: expected primary-expression before 'callback'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:111: error: expected primary-expression before 'void'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:119: error: typedef 'device_write_t' is initialized (use __typeof__ instead)
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:119: error: 'offset_t' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:119: error: expected primary-expression before 'const'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:119: error: expected primary-expression before 'length'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:129: error: 'offset_t' has not been declared
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:148: error: typedef 'device_write_interval_t' is initialized (use __typeof__ instead)
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:148: error: 'offset_t' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:148: error: expected primary-expression before '*' token
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:148: error: 'buffer' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:148: error: expected primary-expression before 'length'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:148: error: expected primary-expression before 'callback'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:148: error: expected primary-expression before 'void'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:161: error: 'device_read_t' does not name a type
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:168: error: 'device_read_interval_t' does not name a type
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:175: error: 'device_write_t' does not name a type
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:182: error: 'device_write_interval_t' does not name a type
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:200: error: 'device_read_t' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:200: error: 'device_read_interval_t' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:200: error: 'device_write_t' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:200: error: 'device_write_interval_t' was not declared in this scope
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:200: error: expected primary-expression before 'index'
C:\Users\Max\Documents\Arduino\Arduino\arduino-0018\libraries\FAT/partition.h:200: error: initializer expression list treated as compound expression
In function 'void setup()': Bad error line: -2
|
|
|
|
|
15
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: how to save data into the buffer?
|
on: June 13, 2010, 12:49:26 am
|
i am sorry, here is the code i have trying to save the value of v that determined by the code #include <sd-reader_config.h> #include <sd_raw.h> #include <sd_raw_config.h> #include <byteordering.h> #include <fat.h> #include <FAT16.h> #include <fat_config.h> #include <partition.h> #include <partition_config.h> #define FREQ_PIN 3 #include <LiquidCrystal.h>
FAT TestFile; //This will be the file we manipulate in the sketch char buffer[512]; //Data will be temporarily stored to this buffer before being written to the file int read_size=0; //Used as an indicator for how many characters are read from the file int count=0; //Miscellaneous variable
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup() { pinMode(FREQ_PIN, INPUT); lcd.begin(16, 2); TestFile.initialize(); TestFile.create_file("Velocity Record.txt"); TestFile.open(); }
void loop() { unsigned long t1 = pulseIn(FREQ_PIN, HIGH);// Time how long it takes to go HIGH again unsigned long t2 = pulseIn(FREQ_PIN, LOW); // and how long it takes to go low again. double t = t1 + t2; double f = 1000000.0/t; double w = 2 * 3.14 * f; double v = w * 0.05; lcd.setCursor(0,0); lcd.println(v); delay(2000); TestFile.write("The velocity of the wheel"); //using the write function will always write to the beginning of the file. // Here we add some text to the file. // Here we add some text to the file. TestFile.close(); //We are done writing to the file for now. Close it for later use.
while(1) TestFile.open(); //Open the file. When the file is opened we will be looking at the beginning of the file. read_size=TestFile.read(buffer); //Read the contents of the file. This will only read the amount of data s read_size=TestFile.read(buffer); //Read the contents of the file. This will only read the amount of data specified // by the size of 'buffer.' sprintf(buffer, "%d", count++); //Now we'll use the buffer to write data back to the file. // Here's we'll only add one value to buffer, the 'count' variable. TestFile.write(buffer); //Write the new buffer to the end of the file TestFile.close(); //Close the file for later use.
delay(1000); //Wait one second before repeating the loop.
}
|
|
|
|
|