Advanced Operating Systems - Final Project A @ Tokyo Tech ////////////// Author: Chu Van Thiem and Sidik Soleman ////////////// A WAVE file player on the MBED Application Board with an interface to a software on PC via a TCP connection. ////////////// Main functions: 1. Browse files of an attached USB flash 2. The list of the files of the attached USB are displayed on the LCD 3. Use an joystick to select a WAVE file and give an instruction to play that file 4. Adjust the volume using a potentiometer 5. Output audio to the analog audio out jack ////////////// Software (https://github.com/thiemcv/VS/tree/master/Terminal): 1. Connect with the MBED application board via Ethernet connection 2. Read the list of files stored on the USB flash 3. Write files to the USB flash
Dependencies: C12832_lcd EthernetInterface USBHost mbed-rtos mbed wave_player
src/main.cpp@0:6a2537e4188b, 2014-01-07 (annotated)
- Committer:
- aos
- Date:
- Tue Jan 07 04:15:05 2014 +0000
- Revision:
- 0:6a2537e4188b
- Child:
- 1:3b567aa3b09e
Created
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aos | 0:6a2537e4188b | 1 | #include "mbed.h" |
aos | 0:6a2537e4188b | 2 | #include "EthernetInterface.h" |
aos | 0:6a2537e4188b | 3 | |
aos | 0:6a2537e4188b | 4 | int main() { |
aos | 0:6a2537e4188b | 5 | EthernetInterface eth; |
aos | 0:6a2537e4188b | 6 | eth.init(); //Use DHCP |
aos | 0:6a2537e4188b | 7 | eth.connect(); |
aos | 0:6a2537e4188b | 8 | printf("IP Address is %s\n", eth.getIPAddress()); |
aos | 0:6a2537e4188b | 9 | |
aos | 0:6a2537e4188b | 10 | TCPSocketConnection sock; |
aos | 0:6a2537e4188b | 11 | sock.connect("mbed.org", 80); |
aos | 0:6a2537e4188b | 12 | |
aos | 0:6a2537e4188b | 13 | char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n"; |
aos | 0:6a2537e4188b | 14 | sock.send_all(http_cmd, sizeof(http_cmd)-1); |
aos | 0:6a2537e4188b | 15 | |
aos | 0:6a2537e4188b | 16 | char buffer[300]; |
aos | 0:6a2537e4188b | 17 | int ret; |
aos | 0:6a2537e4188b | 18 | while (true) { |
aos | 0:6a2537e4188b | 19 | ret = sock.receive(buffer, sizeof(buffer)-1); |
aos | 0:6a2537e4188b | 20 | if (ret <= 0) |
aos | 0:6a2537e4188b | 21 | break; |
aos | 0:6a2537e4188b | 22 | buffer[ret] = '\0'; |
aos | 0:6a2537e4188b | 23 | printf("Received %d chars from server:\n%s\n", ret, buffer); |
aos | 0:6a2537e4188b | 24 | } |
aos | 0:6a2537e4188b | 25 | |
aos | 0:6a2537e4188b | 26 | sock.close(); |
aos | 0:6a2537e4188b | 27 | |
aos | 0:6a2537e4188b | 28 | eth.disconnect(); |
aos | 0:6a2537e4188b | 29 | |
aos | 0:6a2537e4188b | 30 | while(1) {} |
aos | 0:6a2537e4188b | 31 | } |