Psi Swarm robot library version 0.9
Fork of PsiSwarmV9 by
Diff: colour.cpp
- Revision:
- 16:50686c07ad07
- Parent:
- 15:66be5ec52c3b
- Child:
- 17:bf614e28668f
diff -r 66be5ec52c3b -r 50686c07ad07 colour.cpp --- a/colour.cpp Thu Jun 01 21:58:14 2017 +0000 +++ b/colour.cpp Thu Jun 01 23:02:32 2017 +0000 @@ -24,16 +24,14 @@ // Top colour sensor (if fitted) is a TCS34721 #include "psiswarm.h" -int CS_C_BLACK = 63; -int CS_C_WHITE = 802; -int CS_R_BLACK = 22; -int CS_R_WHITE = 244; -int CS_G_BLACK = 24; -int CS_G_WHITE = 297; -int CS_B_BLACK = 16; -int CS_B_WHITE = 232; int last_detected_colour = -1; +void Colour::colour_sensor_init() +{ + colour.set_base_colour_sensor_integration_time(3); + colour.set_base_colour_sensor_gain(4); +} + void Colour::read_base_colour_sensor_values(int * store_array) { char buffer[8] = { 0 }; @@ -113,6 +111,12 @@ colour_ticker.attach_us(this,&Colour::IF_colour_ticker_start, 100); } +void Colour::stop_colour_ticker() +{ + colour_ticker_on = 0; + colour_ticker.detach(); +} + void Colour::IF_colour_ticker_start() { led.set_base_led(1);