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.
Dependencies: SoftSerial SDFileSystem mbed wave_player
Relay.h@29:c2d95d88ee0b, 2017-05-17 (annotated)
- Committer:
- Desertification
- Date:
- Wed May 17 09:43:38 2017 +0000
- Revision:
- 29:c2d95d88ee0b
- Parent:
- 24:d91e9b3b5bd5
DONE (for now)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Thomas Cauwelier |
24:d91e9b3b5bd5 | 1 | // |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 2 | // Created by thoma on 16-May-17. |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 3 | // |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 4 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 5 | #ifndef VISIBLE_LIGHT_COMMUNICATION_RELAY_H |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 6 | #define VISIBLE_LIGHT_COMMUNICATION_RELAY_H |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 7 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 8 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 9 | #include "mbed.h" |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 10 | #include "MySoftSerial.h" |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 11 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 12 | class Relay { |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 13 | public: |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 14 | Relay(PinName tx_luart, int baudrate_luart, PinName tx_usb, PinName rx_usb, int baudrate_usb); |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 15 | void run(); |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 16 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 17 | private: |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 18 | MySoftSerial softSerial; |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 19 | Serial usb; |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 20 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 21 | static const int SEND_FILE = 0b00001111; |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 22 | static const int SET_VOLUME = 0b00110011; |
Desertification | 29:c2d95d88ee0b | 23 | static const int PLAY_LAST = 0b10001011; |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 24 | static const int ACK = 0b11111111; |
Desertification | 29:c2d95d88ee0b | 25 | int buffer[512]; |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 26 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 27 | void handle_type(); |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 28 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 29 | void set_volume(); |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 30 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 31 | void send_file(); |
Desertification | 29:c2d95d88ee0b | 32 | |
Desertification | 29:c2d95d88ee0b | 33 | void play_last(); |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 34 | }; |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 35 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 36 | |
Thomas Cauwelier |
24:d91e9b3b5bd5 | 37 | #endif //VISIBLE_LIGHT_COMMUNICATION_RELAY_H |