The classic dueling tanks game for mbed.
Dependencies: 4DGL-uLCD-SE DRV2605 EthernetInterface Game_Synchronizer MMA8452 SDFileSystem SparkfunAnalogJoystick mbed-rtos mbed wave_player
Fork of 2035_Tanks_Shell by
main.cpp@4:d8bd8b41468d, 2015-10-15 (annotated)
- Committer:
- jford38
- Date:
- Thu Oct 15 19:57:51 2015 +0000
- Revision:
- 4:d8bd8b41468d
- Parent:
- 3:3ddefff03cb2
- Child:
- 5:cfec780c935b
Working without LCD's. Going to add uLCD's now.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jford38 | 0:899c85cd266f | 1 | // THIS GUY LISTENS AND REPEATS. CLIENT. MASTER. |
jford38 | 0:899c85cd266f | 2 | // (It doesn't make sense, I know.) |
jford38 | 0:899c85cd266f | 3 | |
jford38 | 0:899c85cd266f | 4 | #include "mbed.h" |
jford38 | 0:899c85cd266f | 5 | #include "two_player.h" |
jford38 | 0:899c85cd266f | 6 | |
jford38 | 0:899c85cd266f | 7 | |
jford38 | 0:899c85cd266f | 8 | uLCD_2P uLCD(p28,p27,p26, PLAYER1); // serial tx, serial rx, reset pin; |
jford38 | 0:899c85cd266f | 9 | |
jford38 | 0:899c85cd266f | 10 | |
jford38 | 0:899c85cd266f | 11 | int main (void) { |
jford38 | 1:0589ea36661b | 12 | int* buttons; |
jford38 | 1:0589ea36661b | 13 | |
jford38 | 1:0589ea36661b | 14 | pc.printf("\033[2J\033[0;0H"); |
jford38 | 0:899c85cd266f | 15 | pc.printf("I'm alive! Player 1\n"); |
jford38 | 0:899c85cd266f | 16 | |
jford38 | 0:899c85cd266f | 17 | uLCD.init(); |
jford38 | 0:899c85cd266f | 18 | pc.printf("Initialized...\n"); |
jford38 | 0:899c85cd266f | 19 | while(1) { |
jford38 | 3:3ddefff03cb2 | 20 | |
jford38 | 0:899c85cd266f | 21 | uLCD.cls(); |
jford38 | 3:3ddefff03cb2 | 22 | uLCD.background_color(0xAB); |
jford38 | 3:3ddefff03cb2 | 23 | uLCD.line(1,1,2,2, 0xAB); |
jford38 | 3:3ddefff03cb2 | 24 | uLCD.circle(10,10,100, 0xAB); |
jford38 | 3:3ddefff03cb2 | 25 | //uLCD.filled_circle(4,4,10, 0xAB); |
jford38 | 3:3ddefff03cb2 | 26 | //uLCD.triangle(1,1, 2,2, 0,3, 0xAB); |
jford38 | 3:3ddefff03cb2 | 27 | //uLCD.rectangle(0,0, 1,1, 0xAB); |
jford38 | 3:3ddefff03cb2 | 28 | //uLCD.filled_rectangle(1,1, 2,2, 0xAB); |
jford38 | 3:3ddefff03cb2 | 29 | //uLCD.pixel(40, 40, 0xAB); |
jford38 | 3:3ddefff03cb2 | 30 | //uLCD.pen_size(4); |
jford38 | 3:3ddefff03cb2 | 31 | |
jford38 | 3:3ddefff03cb2 | 32 | |
jford38 | 0:899c85cd266f | 33 | uLCD.update(); |
jford38 | 1:0589ea36661b | 34 | buttons = uLCD.get_button_state(); |
jford38 | 1:0589ea36661b | 35 | pc.printf("Button State: %x %x %x %x %x\n", buttons[0], buttons[1], buttons[2], buttons[3], buttons[4]); |
jford38 | 3:3ddefff03cb2 | 36 | wait(1); |
jford38 | 4:d8bd8b41468d | 37 | pc.printf("\033[2J\033[0;0H"); |
jford38 | 3:3ddefff03cb2 | 38 | } |
jford38 | 0:899c85cd266f | 39 | } |