mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-19 19:11:48 +02:00
changed handling of PT Enable PINs
This commit is contained in:
parent
8cb33e3096
commit
b4c0bde8a9
@ -13,6 +13,6 @@ dezibot.multiColorLight.setLed(TOP_RIGHT,dezibot.multiColorLight.color(0,100,0))
|
|||||||
dezibot.multiColorLight.blink(10,0x00FF0000,BOTTOM,500);
|
dezibot.multiColorLight.blink(10,0x00FF0000,BOTTOM,500);
|
||||||
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
dezibot.multiColorLight.turnOff(ALL);
|
dezibot.multiColorLight.turnOffLed(ALL);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Dezibot dezibot = Dezibot();
|
Dezibot dezibot = Dezibot();
|
||||||
void setup() {
|
void setup() {
|
||||||
dezibot.begin();
|
dezibot.begin();
|
||||||
Serial.begin(9600);
|
Serial.begin(115200);
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.println("bla");
|
Serial.println("bla");
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "Dezibot.h"
|
#include "Dezibot.h"
|
||||||
|
|
||||||
Dezibot::Dezibot():multiColorLight(){
|
Dezibot::Dezibot():multiColorLight(){};
|
||||||
|
|
||||||
void Dezibot::begin(void) {
|
void Dezibot::begin(void) {
|
||||||
infraredLight.begin();
|
infraredLight.begin();
|
||||||
@ -21,4 +21,4 @@ void Dezibot::begin(void) {
|
|||||||
multiColorLight.begin();
|
multiColorLight.begin();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
|
||||||
|
@ -47,6 +47,7 @@ photoTransistors LightDetection::getBrightest(ptType type){
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint32_t LightDetection::getAverageValue(photoTransistors sensor, uint32_t measurments, uint32_t timeBetween){
|
uint32_t LightDetection::getAverageValue(photoTransistors sensor, uint32_t measurments, uint32_t timeBetween){
|
||||||
|
|
||||||
TickType_t xLastWakeTime = xTaskGetTickCount();
|
TickType_t xLastWakeTime = xTaskGetTickCount();
|
||||||
TickType_t frequency = timeBetween / portTICK_PERIOD_MS;
|
TickType_t frequency = timeBetween / portTICK_PERIOD_MS;
|
||||||
uint64_t cumulatedResult = 0;
|
uint64_t cumulatedResult = 0;
|
||||||
@ -58,6 +59,7 @@ uint32_t LightDetection::getAverageValue(photoTransistors sensor, uint32_t measu
|
|||||||
};
|
};
|
||||||
|
|
||||||
void LightDetection::beginInfrared(void){
|
void LightDetection::beginInfrared(void){
|
||||||
|
digitalWrite(IR_PT_ENABLE,true);
|
||||||
pinMode(IR_PT_ENABLE, OUTPUT);
|
pinMode(IR_PT_ENABLE, OUTPUT);
|
||||||
pinMode(IR_PT_FRONT_ADC, INPUT);
|
pinMode(IR_PT_FRONT_ADC, INPUT);
|
||||||
pinMode(IR_PT_LEFT_ADC, INPUT);
|
pinMode(IR_PT_LEFT_ADC, INPUT);
|
||||||
@ -66,13 +68,14 @@ void LightDetection::beginInfrared(void){
|
|||||||
};
|
};
|
||||||
|
|
||||||
void LightDetection::beginDaylight(void){
|
void LightDetection::beginDaylight(void){
|
||||||
|
digitalWrite(DL_PT_ENABLE,true);
|
||||||
pinMode(DL_PT_ENABLE, OUTPUT);
|
pinMode(DL_PT_ENABLE, OUTPUT);
|
||||||
pinMode(DL_PT_BOTTOM_ADC, INPUT);
|
pinMode(DL_PT_BOTTOM_ADC, INPUT);
|
||||||
pinMode(DL_PT_FRONT_ADC, INPUT );
|
pinMode(DL_PT_FRONT_ADC, INPUT );
|
||||||
};
|
};
|
||||||
|
|
||||||
uint16_t LightDetection::readIRPT(photoTransistors sensor){
|
uint16_t LightDetection::readIRPT(photoTransistors sensor){
|
||||||
digitalWrite(IR_PT_ENABLE,HIGH);
|
//digitalWrite(IR_PT_ENABLE,HIGH);
|
||||||
uint16_t result = 0;
|
uint16_t result = 0;
|
||||||
switch (sensor)
|
switch (sensor)
|
||||||
{
|
{
|
||||||
@ -91,7 +94,7 @@ uint16_t LightDetection::readIRPT(photoTransistors sensor){
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
digitalWrite(IR_PT_ENABLE,LOW);
|
//digitalWrite(IR_PT_ENABLE,LOW);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user