Your breadboard is one of those which have the power/GND lines interrupted between columns 31 and 33. I also once fell into this trap. If you look closely, you see that the blue and red lines are interrupted in the middle of the board. Just put wires between these pins to bridge the gap.
I would consider placing a light sensor close to one of the lights to signal when the lights are on. Placement is critical as you do not want a signal when the lamp is off. I am assuming they are permanent light fixtures and you are not allowed to tamper with the wiring. Record the elapsed time when they are on. Note the start time and then subtract that ...
I do not know how to interpret the data given by that sensor, but from
reading the code, the meaning of dt is pretty clear.
The function you show assumes that the sensor started in the reference
orientation (quaternion one), then rotated at a constant angular
velocity until it reached the current orientation (quaternion *this),
and this rotation happened ...
This is a resistive sensor and "plain" water is not infinitely conductive. In fact, pure or distilled water is a very poor conductor. Also, "plain" water - tap water, I assume - will vary in its dissolved solids, not only from source to source, but likely over time, too, for some sources and it is these solutes that are responsible for ...
I've configured the timer differently making use of its UserData property. The timer will update the data every fixed period for a specified number of samples.
% Some useful constants.
NUM_SAMPLES = 20;
PERIOD = 0.05;
a = arduino('com4', 'uno');
% Initialise data. It will be updated by the timer.
data.i = 0;
data.v1 = zeros(...
As a couple people already pointed out, you're using for loops that are unnecessary, and will cause you to get the wrong measurements. You're better off just using myservo.write(); to set your servo to positions 0 and 180.
Additionally you never check to see if there's an obstacle infront of your robot. Instead, your robot immediately tries turn right or ...
Next update with 3.1 of the library, you need to call irrecv.decodedIRData.decodedRawData to get the data. This code worked for me:
int IRpin = 11;
irrecv.enableIRIn(); // Start the receiver