0

以下は、カメラがアクティブになっているときの私のコードです。

Serial.println("File Created");
}
//camera operation
Serial.println("Sending Reset command");
SendResetCmd();
Serial.println("Sending Take Photo Command in 3 seconds");
delay(3000);
SendTakePhotoCmd();
// Get Image Size **************************************
Serial.println("Sending Read Image Size command");
delay(80);
GetImageSize();
delay(80);
Serial.print("Image Size: ");


void dumpCameraInput(boolean verbose)
{
    // Use this before issuing a command to be sure the buffer is empty.
    byte incomingbyte;
    if (verbose == true)
        Serial.print("clear camera buffer, dumping...");
    while(mySerial.available() > 0)
    {
        incomingbyte=mySerial.read();
        if (verbose == true)
            Serial.write(incomingbyte);
    }
    if (verbose == true)
        Serial.println("... END DUMPING");
}

void SendResetCmd()
{
    dumpCameraInput(true); //clear camera buffer
    mySerial.write(0x56);
    mySerial.write((byte)0);
    mySerial.write(0x26);
    mySerial.write((byte)0);
}

void SendTakePhotoCmd()
{
    dumpCameraInput(true); //clear camera buffer
    mySerial.write(0x56);
    mySerial.write((byte)0);
    mySerial.write(0x36);
    mySerial.write(0x01);
    mySerial.write((byte)0);
}

結果は次のとおりです。

"File Created
Sending Reset command
clear camera buffer, dumping...v1... END DUMPING
Sending Take Photo Command in 3 seconds
clear camera buffer, dumping...v&VC0703 1.00
Ctrl infr exist
User-defined sensor
625
In... END DUMPING"

「v1」と「dumping...」と「...END DUMPING」の間の単語は必要ありません。

私のコードで何が問題になったのですか? dumpCameraInput(boolean verbose)問題はvoid関数から来ていますか?

4

0 に答える 0