Better Serial C++ class library with interrupt

Dependencies:   RingBuffer

Dependents:   Dumb_box_rev2 mbed_GPSproject

You are viewing an older revision! See the latest version

Homepage

Table of Contents

  1. API
  2. Examples

API

iSerial

Examples

#include "mbed.h"
#include "iSerial.h"

char s[] = "12345678901234567890123456789012345678901234567890";

int main() {

    ISerial pc(USBTX,USBRX);
    char* c = s;

    while(1) {
        pc.puts(s);
        
        while(pc.readable()){
            int ret = pc.getc();
            if(ret)
                *c++ = ret;
            if(c >= s+sizeof(s)-1)
                c = s;
        }
        wait(1);
    }
}

All wikipages