This program demonstrates how to use a MicroNFCBoard as a peripheral to send a message to a phone/tablet using P2P/SNEP/Android Beam.
Dependencies: MicroNFCBoardAPI mbed
Fork of MicroNFCBoardAPI_P2P_Client by
main.cpp@1:5b804c0c8aa8, 2015-05-14 (annotated)
- Committer:
- AppNearMe
- Date:
- Thu May 14 16:43:09 2015 +0000
- Revision:
- 1:5b804c0c8aa8
- Parent:
- 0:e6bbb5a92267
- Child:
- 2:6c08a3907187
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AppNearMe | 0:e6bbb5a92267 | 1 | /* |
AppNearMe | 0:e6bbb5a92267 | 2 | MicroNFCBoard mbed API |
AppNearMe | 0:e6bbb5a92267 | 3 | |
AppNearMe | 0:e6bbb5a92267 | 4 | Copyright (c) 2014-2015 AppNearMe Ltd |
AppNearMe | 0:e6bbb5a92267 | 5 | |
AppNearMe | 0:e6bbb5a92267 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
AppNearMe | 0:e6bbb5a92267 | 7 | you may not use this file except in compliance with the License. |
AppNearMe | 0:e6bbb5a92267 | 8 | You may obtain a copy of the License at |
AppNearMe | 0:e6bbb5a92267 | 9 | |
AppNearMe | 0:e6bbb5a92267 | 10 | http://www.apache.org/licenses/LICENSE-2.0 |
AppNearMe | 0:e6bbb5a92267 | 11 | |
AppNearMe | 0:e6bbb5a92267 | 12 | Unless required by applicable law or agreed to in writing, software |
AppNearMe | 0:e6bbb5a92267 | 13 | distributed under the License is distributed on an "AS IS" BASIS, |
AppNearMe | 0:e6bbb5a92267 | 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
AppNearMe | 0:e6bbb5a92267 | 15 | See the License for the specific language governing permissions and |
AppNearMe | 0:e6bbb5a92267 | 16 | limitations under the License. |
AppNearMe | 0:e6bbb5a92267 | 17 | */ |
AppNearMe | 0:e6bbb5a92267 | 18 | |
AppNearMe | 0:e6bbb5a92267 | 19 | #include "mbed.h" |
AppNearMe | 0:e6bbb5a92267 | 20 | #include "micronfcboard.h" |
AppNearMe | 0:e6bbb5a92267 | 21 | |
AppNearMe | 0:e6bbb5a92267 | 22 | MicroNFCBoard nfc(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, D9); |
AppNearMe | 0:e6bbb5a92267 | 23 | |
AppNearMe | 0:e6bbb5a92267 | 24 | int main() { |
AppNearMe | 0:e6bbb5a92267 | 25 | nfc.init(); |
AppNearMe | 0:e6bbb5a92267 | 26 | bool b = true; |
AppNearMe | 0:e6bbb5a92267 | 27 | for(int i = 0; i < 10; i++) |
AppNearMe | 0:e6bbb5a92267 | 28 | { |
AppNearMe | 0:e6bbb5a92267 | 29 | nfc.setLeds(b, !b); |
AppNearMe | 0:e6bbb5a92267 | 30 | wait_ms(200); |
AppNearMe | 0:e6bbb5a92267 | 31 | b = !b; |
AppNearMe | 0:e6bbb5a92267 | 32 | } |
AppNearMe | 0:e6bbb5a92267 | 33 | } |