n/a

Dependencies:   SoftwareSerial mbed

Fork of XBeeTest by Vlad Cazan

main.cpp

Committer:
yokotay
Date:
2015-12-08
Revision:
3:2531965ba677
Parent:
2:3b1482a11290

File content as of revision 3:2531965ba677:

#include "mbed.h"
#include "SoftwareSerial.h"

SoftwareSerial xbee1(D3, D2);
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);

int main() {
    char buffer[256];
    char *p;
    
    xbee1.baud(9600);
    int count = 1;
    myled = 0;

    while (1) {
            sprintf(buffer, "%d: (yokota) hello.\r\n", count++);
            pc.puts(buffer); //for debugging: print to pc
            p = buffer;
            while (*p) {
                xbee1.putc(*p++);
                wait_ms(2); //required for stable communication
            }   
            wait_ms(1000);
            myled = 1 - myled;
    }
}