forked from pieterbl/ElegooCarV3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElegooCarV3.ino
46 lines (37 loc) · 1.2 KB
/
ElegooCarV3.ino
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
#include <Arduino.h>
#define DEBUG_THE_CAR 1
#define TEST_THE_CAR 0
#include "ElegooCarV3.h"
#include "ElegooInfraredConfig.h"
#include "PanasonicInfraredConfig.h"
#include "MyBluetoothConfig.h"
ElegooCarV3 * car = 0;
// TODO (P1-MED) Implement line-tracking driver option
// TODO (P1-MED) Reduce/shorten output so that the in-App Bluetooth Terminal can be used to see what the car does
void setup()
{
ElegooCarConfig * carConfig = new ElegooCarConfig();
carConfig->SAFETY_DISTANCE_CM = 30;
carConfig->serialConfig.BAUD_RATE = 9600;
carConfig->distanceUnitConfig.SERVO_RIGHT = 20;
carConfig->distanceUnitConfig.SERVO_LEFT = 180;
carConfig->motorUnitConfig.SPEED = 170;
carConfig->infraredReceiverConfig.MAX_NUM_RECEIVERS = 4;
carConfig->bluetoothReceiverConfig.MAX_NUM_RECEIVERS = 4;
car = new ElegooCarV3(carConfig);
car->setup();
car->selectManualDriver();
car->registerInfraredConfig(new ElegooInfraredConfig());
car->registerInfraredConfig(new PanasonicInfraredConfig());
car->registerBluetoothConfig(new MyBluetoothConfig());
car->testDistanceUnit();
if (TEST_THE_CAR)
{
car->testInfrared();
car->testBluetooth();
}
}
void loop()
{
car->drive();
}