#include <cstdlib>
#include <iostream>
#include <string>
#include <conio.h>
#include <iomanip>
#include "nxt.h"
using namespace std;
//set up the NXT
Connection *connection = new Bluetooth();
Brick *nxt = new Brick(connection);
Device_info info;
Device_version version;
unsigned int pad = 10;
int main()
{
string program_name = "Untitled1.rxe"; //remember to set this
try{
cout << "Try to connect to the NXT" << endl;
connection->connect(40);
cout << "Connected" << endl;
cout << "Printing Brick info" << endl;
nxt->get_device_info(info);
nxt->get_device_version(version);
cout <<"Bluetooth address : " << info.bt_address << endl;
cout <<"Free flash memory : " << info.flash_memory << endl;
cout <<"Brick name : " << info.name << endl;
cout <<"Firmware : " << version.firmware << endl;
cout <<"Protocol : " << version.protocol << endl;
cout <<"Barrery level : " << nxt->get_battery_level() << endl;
system("PAUSE");
connection->disconnect();
}
catch (Nxt_exception& e){
//some error occurred - print it out
cout << e.what() << endl;
cout << "error code: " << e.error_code() << endl;
cout << "error type: " << e.error_type() << endl;
cout << e.who() << endl;
connection->disconnect();
}
return 0;
}