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.
Revision 1:d96590319bcf, committed 2018-04-07
- Comitter:
- sangrit
- Date:
- Sat Apr 07 07:40:13 2018 +0000
- Parent:
- 0:d93ce07131fc
- Commit message:
- Arduino
Changed in this revision
Arduino.cpp | Show annotated file Show diff for this revision Revisions of this file |
Arduino.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Arduino.cpp Sat Apr 07 04:11:19 2018 +0000 +++ b/Arduino.cpp Sat Apr 07 07:40:13 2018 +0000 @@ -2,15 +2,15 @@ #include "Arduino.h" -Arduino::Arduino(PinName tx, PinName rx) : _tx(tx), _rx(rx){ +Arduino::Arduino(PinName tx, PinName rx) : _arduino(tx,rx){ _arduino.baud(9600); } -void Arduino::_sendCommand(char com){ - _arduino.clc(); +void Arduino::sendCommand(char com){ + //_arduino.clc(); _arduino.printf("&c", com); } -int Arduino::_recieveData(){ +int Arduino::receiveData(){ char value[100]; int index=0; char ch; @@ -29,22 +29,22 @@ } int Arduino::getLdrY(){ - _sendCommand('y'); - return _recieveData(); + sendCommand('y'); + return this->receiveData(); } int Arduino::getLdrX(){ - _sendCommand('x'); - return _recieveData(); + sendCommand('x'); + return receiveData(); } int Arduino::getColor(){ - _sendCommand('c'); - return _recieveData(); + sendCommand('c'); + return receiveData(); } int Arduino::getOrientation(){ - _sendCommand('a'); - return _recieveData(); + sendCommand('a'); + return receiveData(); }
--- a/Arduino.h Sat Apr 07 04:11:19 2018 +0000 +++ b/Arduino.h Sat Apr 07 07:40:13 2018 +0000 @@ -11,10 +11,12 @@ int getColor(); int getOrientation(); + void sendCommand(char com); + private: - Serial _arduino(_tx, _rx); - void _sendCommand(); - int _receiveData(); + int receiveData(); + Serial _arduino; + }; #endif \ No newline at end of file