-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchall4.cpp
45 lines (40 loc) · 939 Bytes
/
chall4.cpp
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
/*
* chall4.h
* Purple Mountain Majesties
* - Alexander Lea, Connor Nightingale, Eddy Zhang, Jacob Carulli
* Spring 2024
*
*/
#include <Arduino.h>
#include "chall4.h"
#include "drive.h"
#include "collision.h"
#include "light_comm.h"
#include "pins.h"
/* Function: run
* Description: Run with companion bot to demonstrate challenge 4
* Parameters:
* - None
* Returns: None
*/
void Chall4::run() {
Drive& drive = Drive::getInstance();
Light_Comm light_comm;
while(not collision_detected()){
drive.forward();
}
drive.stopFor(300);
light_comm.chall1_receive();
delay(1800);
light_comm.chall1_send();
digitalWrite(Pins::headlights, HIGH);
delay(250);
digitalWrite(Pins::headlights, LOW);
delay(250);
digitalWrite(Pins::headlights, HIGH);
delay(250);
digitalWrite(Pins::headlights, LOW);
delay(250);
digitalWrite(Pins::leftTurnSignal, HIGH);
digitalWrite(Pins::rightTurnSignal, HIGH);
}