Silvan Li
/
mbedKart_sp
single player mbedKart
(notes)
Diff: main.cpp
- Revision:
- 9:6649141315be
- Parent:
- 8:92bf0cc337b5
- Child:
- 10:83c5333f5b16
- Child:
- 11:8d4b7702ac06
--- a/main.cpp Mon Dec 10 02:35:13 2018 +0000 +++ b/main.cpp Mon Dec 10 02:56:30 2018 +0000 @@ -57,23 +57,7 @@ } ThisThread::sleep_for(500); } -} - -// Thread for detecting item boxes -int sensor_addr = 41 << 1; -void item_thread() { - // Read data from color sensor (Clear/Red/Green/Blue) - while (true) { - myRGBled.write(1.0,0.0,0.0); //red - ThisThread::sleep_for(2000); - myRGBled.write(0.0,1.0,0.0); //green - ThisThread::sleep_for(2000); - myRGBled.write(0.0,0.0,1.0); //blue - ThisThread::sleep_for(2000); - myRGBled.write(1.0,0.2,0.0); //yellow = red + some green - ThisThread::sleep_for(2000); - } -} +} // Thread for checking rgb sensor values and updating game variables // Change later depending on behavior of RGB sensor and colors used @@ -110,12 +94,10 @@ // Define threads Thread thread1; -Thread thread2; int main() { // Start threads - thread1.start(item_thread); - thread2.start(check_RGB); + thread1.start(check_RGB); // Bluetooth controller code char bnum=0;