Arduino: Serial Chargen

I wanted to test serial on my BeagleBone Black, so I need a source that would spit out a bunch of serial data. I wrote up a quick serial chargen script for Arduino. Now I have an endless source of serial traffic.

void setup() {
    Serial.begin(9600);
}

int offset = 0;
void loop() {
    // Whatever string we want to spit out
    const char* str = "abcdefghijklmnopqrtuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()";
    int len         = strlen(str);

    for (int i = 0; i < len; i++) {
        int char_num = i + offset;
        char_num     = char_num % len; // Roll around the end if we go to far

        char c       = str[char_num];

        Serial.print(c);
    }

    Serial.print("\n");
    offset++;

    if (offset >= len) { offset = 0; }
}


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 44.200.39.110
To prevent spam please submit by clicking the kitten: