-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwalltest.cpp
More file actions
36 lines (33 loc) · 831 Bytes
/
walltest.cpp
File metadata and controls
36 lines (33 loc) · 831 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
#include <iostream>
#include "wallfollower.cpp"
int running=1;
void sig_handler(int signo)
{
if (signo == SIGINT) {
printf("closing PWM nicely\n");
running = 0;
}
};
int main(){
signal(SIGINT, sig_handler);
Motor* left = new Motor(0,2,4,false);
Motor* right = new Motor(4,6,2,true);
Location* location = new Location(0.0,0.0,0.0);
IR* irf = new IR(0);
IR* irr = new IR(1);
IR* irlf = new IR(3);
IR* irlb = new IR(2);
mraa::Gpio* uirb = new mraa::Gpio(8);
Wallfollower* wf= new Wallfollower(left,right,irf,irr,irlf,irlb,uirb,location);
int channel=1;
bool localized = false;
while(running &&!localized) {
channel = wf->run_follower(channel);
int mode=wf->locating_channel();
std::cout<<"I am in channel:"<<channel<<std::endl;
}
left->stop();
right->stop();
sleep(1);
return 0;
}