arduino Serial Communication Base64 filtering for serial input data


Example

String base64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

void setup() {

    Serial.begin(9600); // Turn the serial protocol ON
    Serial.println("Start Typing");
}

void loop() {

    if (Serial.available() > 0) { // Check if data has been sent from the user
        char c = Serial.read();   // Gets one byte/Character from serial buffer
        int result = base64.indexOf(c); // Base64 filtering
        if (result>=0)
            Serial.print(c); // Only print Base64 string
    }
}