Lets you control your mbed from an easy to use GUI. Entire project is on git hub: https://github.com/navin-bhaskar/Controller For usage info follow this link http://navinbhaskar.blogspot.in/2013/02/arduino-controller-3.html
MbedConsole.cpp@0:fe5850ccdb6f, 2013-02-26 (annotated)
- Committer:
- Navin
- Date:
- Tue Feb 26 03:45:52 2013 +0000
- Revision:
- 0:fe5850ccdb6f
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Navin | 0:fe5850ccdb6f | 1 | /* |
Navin | 0:fe5850ccdb6f | 2 | * This program is free software; you can redistribute it and/or modify |
Navin | 0:fe5850ccdb6f | 3 | * it under the terms of the GNU General Public License as published by |
Navin | 0:fe5850ccdb6f | 4 | * the Free Software Foundation; either version 2 of the License, or |
Navin | 0:fe5850ccdb6f | 5 | * (at your option) any later version. |
Navin | 0:fe5850ccdb6f | 6 | * |
Navin | 0:fe5850ccdb6f | 7 | * This program is distributed in the hope that it will be useful, |
Navin | 0:fe5850ccdb6f | 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Navin | 0:fe5850ccdb6f | 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Navin | 0:fe5850ccdb6f | 10 | * GNU General Public License for more details. |
Navin | 0:fe5850ccdb6f | 11 | * |
Navin | 0:fe5850ccdb6f | 12 | * You should have received a copy of the GNU General Public License |
Navin | 0:fe5850ccdb6f | 13 | * along with this program; if not, write to the Free Software |
Navin | 0:fe5850ccdb6f | 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
Navin | 0:fe5850ccdb6f | 15 | * MA 02110-1301, USA. |
Navin | 0:fe5850ccdb6f | 16 | * |
Navin | 0:fe5850ccdb6f | 17 | */ |
Navin | 0:fe5850ccdb6f | 18 | |
Navin | 0:fe5850ccdb6f | 19 | #include "Console.h" |
Navin | 0:fe5850ccdb6f | 20 | #include <stdarg.h> |
Navin | 0:fe5850ccdb6f | 21 | #include "MbedConsole.h" |
Navin | 0:fe5850ccdb6f | 22 | #include "mbed.h" |
Navin | 0:fe5850ccdb6f | 23 | |
Navin | 0:fe5850ccdb6f | 24 | extern Serial pc; |
Navin | 0:fe5850ccdb6f | 25 | |
Navin | 0:fe5850ccdb6f | 26 | void MbedConsole::printf(char * fmt, ...) |
Navin | 0:fe5850ccdb6f | 27 | { |
Navin | 0:fe5850ccdb6f | 28 | char tmp[64]; |
Navin | 0:fe5850ccdb6f | 29 | va_list args; |
Navin | 0:fe5850ccdb6f | 30 | va_start(args, fmt); |
Navin | 0:fe5850ccdb6f | 31 | vsnprintf(tmp, 64, fmt, args); |
Navin | 0:fe5850ccdb6f | 32 | va_end(args); |
Navin | 0:fe5850ccdb6f | 33 | pc.printf("%s", tmp); |
Navin | 0:fe5850ccdb6f | 34 | } |
Navin | 0:fe5850ccdb6f | 35 | |
Navin | 0:fe5850ccdb6f | 36 | int MbedConsole::available() |
Navin | 0:fe5850ccdb6f | 37 | { |
Navin | 0:fe5850ccdb6f | 38 | return pc.readable(); |
Navin | 0:fe5850ccdb6f | 39 | } |
Navin | 0:fe5850ccdb6f | 40 |