Jump to content


Arduinorobot

Member Since 23 Feb 2015
Offline Last Active Mar 11 2015 02:58 PM
-----

Posts I've Made

In Topic: ArduinoRobot

10 March 2015 - 04:48 PM

Ok thank's but which values get they during the loop ?

And in this part here: we check to see if looPeriod milliseconds has elapsed since the last time the code in the loop was executed. do you mean, if loop period has elapsed it starts again by void loop:

void loop()
{
    debugOutput(); // prints debugging messages to the serial console
 ...

In Topic: ArduinoRobot

09 March 2015 - 08:48 PM

But I have another question, what does timeSerialdelay and timeLoopdelay. Because they have no value, just 0 but why 0.

const int serialPeriod = 250;       // only print to the serial console every 1/4 second
unsigned long timeSerialDelay = 0;

const int loopPeriod = 20;          // a period of 20ms = a frequency of 50Hz
unsigned long timeLoopDelay   = 0;

and this part here:

void loop()
{
    debugOutput(); // prints debugging messages to the serial console
    
    if(millis() - timeLoopDelay >= loopPeriod)
    {
        readUltrasonicSensors(); // read and store the measured distances
        
        timeLoopDelay = millis();

the part with if(millis() - timeLoopdelay  >= loopPeriod) what does it mean ? And why the timeLoopDelay = millis();  Sorry for so many questions but I need it for school and I will try to understand :D


In Topic: ArduinoRobot

04 March 2015 - 02:24 PM

Ok it's done. I just needed to return the Arduino motorsboard to it's default state. Now it works fine :)