Here's my code, but it doesn't seem to run.
My goal is to collect the data every one millisecond.
Hardware is Arduino Ethernet.
I will be adding 6 discrete inputs to the collection once i get this part working.
I'll also later add code to dump all the data to a PC that is running VB, over ethernet.
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int MyArray1[700];
int MyArray2[700];
int MyIndex = 1;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
delay(300);
Serial.println("Here we go.");
}
void loop() {
if (MyIndex < 600){
MyArray1[MyIndex] = millis();
MyArray2[MyIndex] = analogRead(analogInPin);
//Serial.println(MyIndex);
}
if (MyIndex == 600){
Serial.print(MyArray1[2]);
Serial.print(", " );
Serial.print(MyArray2[2]);
Serial.println("");
}
MyIndex = MyIndex + 1;
}
jestal:
Here's my code, but it doesn't seem to run.
My goal is to collect the data every one millisecond.
Hardware is Arduino Ethernet.
I will be adding 6 discrete inputs to the collection once i get this part working.
I'll also later add code to dump all the data to a PC that is running VB, over ethernet.
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int MyArray1[700];
int MyArray2[700];
int MyIndex = 1;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
delay(300);
Serial.println("Here we go.");
}
The problem is that your defining of int MyArray1[700]; and int MyArray2[700]; takes up 2800 bytes of SRAM, where as a 328p based arduino board only has 2,048 bytes avalible in total. So you see the fundamental problem here?
After downloading to the hardware the sketch program says:
Binary sketch size: 2,486 bytes (of a 32,256 byte maximum)
On the page for the Ethernet board:
Memory
The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).
It generates a warning that possible truncation could occur. It is up to you yo then determine if that really could happen. Since warnings are disabled, you never actually see the warning, but one IS generated.