I understand that shield_sdlog saves the NMEA sentences to an incremented text file each time the sketch is run. I would like to integrate the code in shield_sdlog into my code to spin the motor such that I begin recording NMEA sentences, I complete a full rotation, and I close and stop saving to the SD card. Then when I am ready to run the rotation again, it will save to a new file.
It is and preferable that the GPS continue to maintain a fix, but I would like to refrain from saving to the SD card in the down time between rotations. Also, a primary goal is for the initial time stamp of each new file indicate when each rotation begins.
So to summarize, I will push a button that will begin to save NMEA sentences in a text file on an SD card, followed by a rotation of the stepper motor. Upon completion of a full rotation, the data recording will stop, the file will be saved and the system will wait until the button is pressed again when it will repeat the process.
Below is the code for rotating the object using the stepper motor:
Code: Select all
else if( analogRead(A3)<500 && analogRead(A2)<500 && analogRead(A1)>500 ) //*** DATA ROTATION GATHERING ***//
{
lcd.clear();
lcd.setCursor(3,0);
lcd.print("COLLECTING");
lcd.setCursor(4,1);
lcd.print("GPS DATA");
delay(100);
while(c < TRUE){
rotate_phone();
c++;
}
void rotate_phone()
{
int b = 0;
int c = 0;
while (b < 16)
{
for (int i = 0; i <133; i++)
{
digitalWrite(Enable, LOW); //Turns Enable low and allows the driver to operate.
digitalWrite(stepper, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3); //Wait for 5ms
digitalWrite(stepper, LOW); // turn the LED off by making the voltage LOW
delay(3);
}
digitalWrite(Enable, HIGH); //Turns Enable HIGH which turns off the driver. We do this to conserve power and to keep motor temperature down.
delay (29202);
for (int i = 0; i <134; i++)
{
digitalWrite(Enable, LOW); //Turns Enable low and allows the driver to operate.
digitalWrite(stepper, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3); //Wait for 5ms
digitalWrite(stepper, LOW); // turn the LED off by making the voltage LOW
delay(3);
}
digitalWrite(Enable, HIGH); //Turns Enable HIGH which turns off the driver. We do this to conserve power and to keep motor temperature down.
delay (29196);
for (int i = 0; i <133; i++)
{
digitalWrite(Enable, LOW); //Turns Enable low and allows the driver to operate.
digitalWrite(stepper, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3); //Wait for 5ms
digitalWrite(stepper, LOW); // turn the LED off by making the voltage LOW
delay(3);
}
digitalWrite(Enable, HIGH); //Turns Enable HIGH which turns off the driver. We do this to conserve power and to keep motor temperature down.
delay (29202);
b++;
}
}