Dezibot 4
Loading...
Searching...
No Matches
IRDirection.ino
Go to the documentation of this file.
1#include "Dezibot.h"
2
3Dezibot dezibot = Dezibot();
4void setup() {
5 // put your setup code here, to run once:
6 dezibot.begin();
7 Serial.begin(115200);
8}
9
10void loop() {
11 // put your main code here, to run repeatedly:
12 Serial.print("Front:");
13 Serial.print(dezibot.lightDetection.getAverageValue(IR_FRONT,20,1));
14 Serial.print(",Left:");
15 Serial.print(dezibot.lightDetection.getAverageValue(IR_LEFT,20,1));
16 Serial.print(",Right:");
17 Serial.print(dezibot.lightDetection.getAverageValue(IR_RIGHT,20,1));
18 Serial.print(",Back:");
19 Serial.println(dezibot.lightDetection.getAverageValue(IR_BACK,20,1));
20 switch(dezibot.lightDetection.getBrightest(IR)){
21 case IR_FRONT:
22 dezibot.multiColorLight.setTopLeds(BLUE);
23 break;
24 case IR_LEFT:
25 dezibot.multiColorLight.setTopLeds(RED);
26 break;
27 case IR_RIGHT:
28 dezibot.multiColorLight.setTopLeds(GREEN);
29 break;
30 case IR_BACK:
31 dezibot.multiColorLight.setTopLeds(YELLOW);
32 break;
33 }
34 //delay(100);
35}