Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RemoteIR m3pi mbed-rtos mbed
Diff: Controller.cpp
- Revision:
- 1:76cff32344d1
- Child:
- 7:1d77c7e0208c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Controller.cpp Tue May 09 23:02:13 2017 +0200
@@ -0,0 +1,33 @@
+//
+// Created by Kristof on 5/9/2017.
+//
+
+#include "Controller.h"
+
+Controller::Controller() {
+ //constructor once to initialise
+ static LightCommunication lightCommunication;
+ car = new m3pi();
+ receiveThread.start(&LightCommunication::receiveData);
+ ir_rx = new ReceiverIR(p21);
+}
+
+Controller::~Controller() {
+
+}
+
+int Controller::run() {
+
+ LightCommunication::mut.lock();
+ if (LightCommunication::needsToStop()){
+ car->stop();
+ LightCommunication::mut.unlock();
+ }else {
+ current_left = LightCommunication::getLeft(current_left);
+ current_right = LightCommunication::getRight(current_right);
+ LightCommunication::mut.unlock();
+ car->left_motor(current_left) ;
+ car->right_motor(current_right) ;
+ }
+ return 0;
+}
