blob: cf80770a0569db655134e7db48e227816ceb9915 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "stdafx.h"
int main()
{
//Init our robot
Robot* localRobot = new Robot();
//Init Engines
for(uint8 i = IO_ENGINE_START; i < IO_ENGINE_END; i++)
{
Engine* newEngine = new Engine(i);
localRobot->AddModule(newEngine);
newEngine = NULL;
}
//Init Sensors
for(uint8 i = IO_SENSOR_START; i < IO_SENSOR_END; i++)
{
SensorTypes newSensorType;
switch(i)
{
//Cases when sensor is digital:
// newSensorType = SENSOR_TYPE_DIGITAL;
// break;
//Other cases
default:
newSensorType = SENSOR_TYPE_ANALOG;
break;
}
Sensor* newSensor = new Sensor(i, newSensorType);
localRobot->AddModule(newSensor);
newSensor = NULL;
}
//Run
while(true)
{
localRobot->Update();
}
//Cleanup
delete localRobot;
localRobot = NULL;
}
|