Dependencies: XBeeLib mbed HvZAlphaNumLib HvZServerLib
main.cpp@0:9cdba0589ba2, 2010-12-12 (annotated)
- Committer:
- etherealflaim
- Date:
- Sun Dec 12 19:35:00 2010 +0000
- Revision:
- 0:9cdba0589ba2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
etherealflaim | 0:9cdba0589ba2 | 1 | #include "mbed.h" |
etherealflaim | 0:9cdba0589ba2 | 2 | #include "lib/iHvZ.hpp" |
etherealflaim | 0:9cdba0589ba2 | 3 | #include "XBee.hpp" |
etherealflaim | 0:9cdba0589ba2 | 4 | #include "string.h" |
etherealflaim | 0:9cdba0589ba2 | 5 | |
etherealflaim | 0:9cdba0589ba2 | 6 | iHvZ game("TEST_UID"); |
etherealflaim | 0:9cdba0589ba2 | 7 | Serial usb(USBTX, USBRX); |
etherealflaim | 0:9cdba0589ba2 | 8 | DigitalOut human_led(LED1); |
etherealflaim | 0:9cdba0589ba2 | 9 | |
etherealflaim | 0:9cdba0589ba2 | 10 | void dots() { |
etherealflaim | 0:9cdba0589ba2 | 11 | usb.printf("."); |
etherealflaim | 0:9cdba0589ba2 | 12 | } |
etherealflaim | 0:9cdba0589ba2 | 13 | |
etherealflaim | 0:9cdba0589ba2 | 14 | Ticker dotter; |
etherealflaim | 0:9cdba0589ba2 | 15 | |
etherealflaim | 0:9cdba0589ba2 | 16 | int main() { |
etherealflaim | 0:9cdba0589ba2 | 17 | dotter.attach(dots, 10); |
etherealflaim | 0:9cdba0589ba2 | 18 | |
etherealflaim | 0:9cdba0589ba2 | 19 | usb.printf("Starting iHvZ:\r\n"); |
etherealflaim | 0:9cdba0589ba2 | 20 | |
etherealflaim | 0:9cdba0589ba2 | 21 | if (game.load()) |
etherealflaim | 0:9cdba0589ba2 | 22 | { |
etherealflaim | 0:9cdba0589ba2 | 23 | usb.printf(" - Loading state from file\r\n"); |
etherealflaim | 0:9cdba0589ba2 | 24 | } |
etherealflaim | 0:9cdba0589ba2 | 25 | else |
etherealflaim | 0:9cdba0589ba2 | 26 | { |
etherealflaim | 0:9cdba0589ba2 | 27 | usb.printf(" - Starting as ZOMBIE (no file read)\r\n"); |
etherealflaim | 0:9cdba0589ba2 | 28 | //game.life("FAKE_TID"); |
etherealflaim | 0:9cdba0589ba2 | 29 | } |
etherealflaim | 0:9cdba0589ba2 | 30 | game.save(); |
etherealflaim | 0:9cdba0589ba2 | 31 | |
etherealflaim | 0:9cdba0589ba2 | 32 | while(1) |
etherealflaim | 0:9cdba0589ba2 | 33 | { |
etherealflaim | 0:9cdba0589ba2 | 34 | //(game.alphanumdisplay_device()).display('H'); |
etherealflaim | 0:9cdba0589ba2 | 35 | human_led = game.status() == STATUS_HUMAN; |
etherealflaim | 0:9cdba0589ba2 | 36 | wait(.1); |
etherealflaim | 0:9cdba0589ba2 | 37 | } |
etherealflaim | 0:9cdba0589ba2 | 38 | } |