The purpose of this project was to create a system that would allow users to monitor a locked device using a Bluetooth device. This Bluetooth device will show the last user that unlocked the device, and also allows the user to unlock the device using the Bluetooth device. This device can be physically unlocked using a capacitive touch keypad sensor.
Dependencies: mbed Motor Servo
Fork of SerialPassthrough_LPC1768 by
main.cpp@6:0398d0fcc8cc, 2015-09-16 (annotated)
- Committer:
- 4180_1
- Date:
- Wed Sep 16 16:28:29 2015 +0000
- Revision:
- 6:0398d0fcc8cc
- Parent:
- 5:96cb82af9996
- Child:
- 7:79d0b30fedb4
ver 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 0:59bec1fd956e | 1 | #include "mbed.h" |
mbedAustin | 2:a8dcb07a1d00 | 2 | |
sam_grove | 5:96cb82af9996 | 3 | RawSerial pc(USBTX, USBRX); |
4180_1 | 6:0398d0fcc8cc | 4 | RawSerial dev(p28,p27); |
sam_grove | 5:96cb82af9996 | 5 | DigitalOut led1(LED1); |
sam_grove | 5:96cb82af9996 | 6 | DigitalOut led4(LED4); |
mbedAustin | 2:a8dcb07a1d00 | 7 | |
sam_grove | 5:96cb82af9996 | 8 | void dev_recv() |
mbedAustin | 2:a8dcb07a1d00 | 9 | { |
sam_grove | 5:96cb82af9996 | 10 | led1 = !led1; |
sam_grove | 5:96cb82af9996 | 11 | while(dev.readable()) { |
sam_grove | 5:96cb82af9996 | 12 | pc.putc(dev.getc()); |
sam_grove | 5:96cb82af9996 | 13 | } |
sam_grove | 5:96cb82af9996 | 14 | } |
sam_grove | 5:96cb82af9996 | 15 | |
sam_grove | 5:96cb82af9996 | 16 | void pc_recv() |
sam_grove | 5:96cb82af9996 | 17 | { |
sam_grove | 5:96cb82af9996 | 18 | led4 = !led4; |
sam_grove | 5:96cb82af9996 | 19 | while(pc.readable()) { |
mbedAustin | 4:ba9100d52e48 | 20 | dev.putc(pc.getc()); |
mbedAustin | 0:59bec1fd956e | 21 | } |
mbedAustin | 0:59bec1fd956e | 22 | } |
mbedAustin | 4:ba9100d52e48 | 23 | |
mbedAustin | 4:ba9100d52e48 | 24 | int main() |
mbedAustin | 4:ba9100d52e48 | 25 | { |
mbedAustin | 4:ba9100d52e48 | 26 | pc.baud(9600); |
mbedAustin | 4:ba9100d52e48 | 27 | dev.baud(9600); |
mbedAustin | 4:ba9100d52e48 | 28 | |
sam_grove | 5:96cb82af9996 | 29 | pc.attach(&pc_recv, Serial::RxIrq); |
sam_grove | 5:96cb82af9996 | 30 | dev.attach(&dev_recv, Serial::RxIrq); |
sam_grove | 5:96cb82af9996 | 31 | |
mbedAustin | 4:ba9100d52e48 | 32 | while(1) { |
sam_grove | 5:96cb82af9996 | 33 | sleep(); |
mbedAustin | 4:ba9100d52e48 | 34 | } |
mbedAustin | 4:ba9100d52e48 | 35 | } |