-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (28 loc) · 793 Bytes
/
main.cpp
File metadata and controls
36 lines (28 loc) · 793 Bytes
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
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <HotBox.h>
// put function declarations here:
HotBox box = HotBox(1);
HotBox box2 = HotBox(2);
FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_16> can1;
void setup() {
// Start Serial and wait for connection
Serial.begin(9600);
while (!Serial) { ; } // Wait for USB Serial
Serial.println("START");
// Start CAN bus
can1.begin();
can1.setBaudRate(250000);
delay(500);
// Start HotBox instances safely
Serial.println("Initializing HotBoxes...");
box.start(&can1, 1); // wheel 1
box2.start(&can1, 2); // wheel 2
Serial.println("HotBox initialization attempted.");
Serial.println("Setup complete. Entering loop...");
}
void loop() {
box.readValues();
box2.readValues();
}