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.
main.cpp@1:1c8a6c4ddc4f, 2016-02-19 (annotated)
- Committer:
- DiegoRivera
- Date:
- Fri Feb 19 13:29:05 2016 +0000
- Revision:
- 1:1c8a6c4ddc4f
- Parent:
- 0:bc7b5ae725ef
- Child:
- 2:f9a8ccac21e4
ok Serial de arduino
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DiegoRivera | 0:bc7b5ae725ef | 1 | #include "mbed.h" |
DiegoRivera | 0:bc7b5ae725ef | 2 | #include "Cerradura.h" |
DiegoRivera | 0:bc7b5ae725ef | 3 | |
DiegoRivera | 0:bc7b5ae725ef | 4 | //DigitalOut cerradura (D2); |
DiegoRivera | 0:bc7b5ae725ef | 5 | |
DiegoRivera | 0:bc7b5ae725ef | 6 | Serial bluetooth(USBTX, USBRX); |
DiegoRivera | 1:1c8a6c4ddc4f | 7 | Cerradura cerradura(LED2); //clase para abrir y crrar cerradura |
DiegoRivera | 0:bc7b5ae725ef | 8 | |
DiegoRivera | 1:1c8a6c4ddc4f | 9 | void leer() //interrupcion rx serial |
DiegoRivera | 0:bc7b5ae725ef | 10 | { |
DiegoRivera | 1:1c8a6c4ddc4f | 11 | int in; |
DiegoRivera | 1:1c8a6c4ddc4f | 12 | bluetooth.scanf("%d", &in); |
DiegoRivera | 0:bc7b5ae725ef | 13 | if(in==1) |
DiegoRivera | 0:bc7b5ae725ef | 14 | cerradura.abrir(); |
DiegoRivera | 0:bc7b5ae725ef | 15 | if(in==0) |
DiegoRivera | 0:bc7b5ae725ef | 16 | cerradura.cerrar(); |
DiegoRivera | 0:bc7b5ae725ef | 17 | } |
DiegoRivera | 0:bc7b5ae725ef | 18 | |
DiegoRivera | 0:bc7b5ae725ef | 19 | int main() |
DiegoRivera | 0:bc7b5ae725ef | 20 | { |
DiegoRivera | 0:bc7b5ae725ef | 21 | bluetooth.baud(9600); |
DiegoRivera | 0:bc7b5ae725ef | 22 | bluetooth.format(8, SerialBase::None, 1); |
DiegoRivera | 0:bc7b5ae725ef | 23 | bluetooth.attach(&leer, Serial::RxIrq); |
DiegoRivera | 0:bc7b5ae725ef | 24 | while(1) |
DiegoRivera | 0:bc7b5ae725ef | 25 | { |
DiegoRivera | 0:bc7b5ae725ef | 26 | } |
DiegoRivera | 0:bc7b5ae725ef | 27 | } |