Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Android.cpp
- Committer:
- maskas
- Date:
- 2018-01-08
- Revision:
- 1:6d9353593c3c
- Parent:
- 0:9b41a36d03d9
- Child:
- 2:aeecb6277fc7
File content as of revision 1:6d9353593c3c:
#include "mbed.h" #include "Android.h" Android::Android(PinName txPin, PinName rxPin, Carousel& carousel): serial(txPin, rxPin), myled(LED1), carousel(carousel) { //Serial pc(USBTX, USBRX); // tx, rx this->serial.baud(115200); this->serial.attach(callback(this, &Android::onData)); this->ticker.attach(callback(this, &Android::hearthBeat), 5.0f); this->carousel.callibrate(); } void Android::hearthBeat(void) { printf("HEARTH BEAT SENT\n"); this->serial.printf("ARD_HB"); this->serial.putc(-91); this->serial.printf("OK"); this->serial.putc(-91); } void Android::onData(void) { char command[50]; int product; if (this->serial.readable()) { this->serial.scanf("%s", &command); this->serial.scanf("%d", &product); printf(command); printf("%d", product); printf("Command Received: \r\n"); } }