Multiple void loops with scheduler.h

Im trying to get multiple void loops using the scheduler.h function on my uno.
First time I’ve used the scheduler function and it doesn’t seem to like it. Can anyone figure out why?

#include <Scheduler.h>


#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>


//constants for LEDs
int greenLED = 12;
int redLED = 13;

//set our code
char* ourCode = "123";
int currentPosition = 0;

char* ourCode4 = "12345";
int currentPosition4 = 0;

//define the keypad
const byte rows = 4;
const byte cols = 4;

char keys[rows][cols] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[rows] = {11,10,9,8};
byte colPins[cols] = {7,6,5,4};

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);

#define GPIO_ADDR   0x27
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);    // set the LCD I2C address

void setup() {

lcd.begin(16,2);
{
  Scheduler.startLoop(loop2);
}



void loop()
{
  int l;
  
  char key = keypad.getKey();
  
  if (int(key) != 0) {
    lcd.setCursor(14,3);
    lcd.print("    ");
    lcd.setCursor(10,3);
    
    for (l=0; l<=currentPosition; ++l)
    {
      lcd.print("*");
    }
    if (key == ourCode4[currentPosition])
      {
        ++currentPosition;
        if (currentPosition == 5)
        {
          unlockDoor4();
          currentPosition = 0;
        }
      } else {
        invalidCode();
        currentPosition = 0;
      }
  }
}

void loop2() {
  int l;
  
  char key = keypad.getKey();
  
  if (int(key) != 0) {
    lcd.setCursor(14,3);
    lcd.print("    ");
    lcd.setCursor(10,3);
    
    for (l=0; l<=currentPosition; ++l)
    {
      lcd.print("*");
    }
    if (key == ourCode[currentPosition])
      {
        ++currentPosition;
        if (currentPosition == 3)
        {
          unlockDoor();
          currentPosition = 0;
        }
      } else {
        invalidCode();
        currentPosition = 0;
      }
      
  }
}

void invalidCode()
{
  digitalWrite(redLED, HIGH);
  clearScreen();
  lcd.setCursor(0,0);
  lcd.print("No Letter Found");
  lcd.setCursor(0,1);
  lcd.print("");
  lcd.setCursor(0,2);
  lcd.print("");
  lcd.setCursor(0,3);
  lcd.print("");
  
  delay(2000);
  digitalWrite(redLED, LOW);
  displayCodeEntryScreen();
}

void unlockDoor()
{
  digitalWrite(greenLED, HIGH);
  clearScreen();
  lcd.setCursor(0,0);
  lcd.print("**  WELCOME!  **");
  lcd.setCursor(0,1);
  lcd.print("");
  lcd.setCursor(0,2);
  lcd.print("");
  lcd.setCursor(0,3);
  lcd.print("********************");
  
  
  delay(2000);
  digitalWrite(greenLED, LOW);
  displayCodeEntryScreen();
}

void unlockDoor4()
{
  digitalWrite(greenLED, HIGH);
  clearScreen();
  lcd.setCursor(0,0);
  lcd.print("*  Letter: Q  *");
  lcd.setCursor(0,1);
  lcd.print("");
  lcd.setCursor(0,2);
  lcd.print("");
  lcd.setCursor(0,3);
  lcd.print("");
  
  "145" ; //add any code to unlock the door here
  delay(5000);
  digitalWrite(greenLED, LOW);
  displayCodeEntryScreen();
}


void displayCodeEntryScreen()
{
  clearScreen();
  lcd.setCursor(0,0);
  lcd.print("Tactus");
  lcd.setCursor(0,1);
  lcd.print("");
  lcd.setCursor(0,2);
  lcd.print("Enter:");
}

void clearScreen()
{
  for (int i = 0; i < rows; i++) {

     lcd.setCursor(0,i);
     lcd.print("                    ");
  }
}

Error:
C:\Users\q\Documents\Arduino\Tuesday_NotWorking5\Tuesday_NotWorking5.ino: In function ‘void setup()’:
Tuesday_NotWorking5:43: error: expected unqualified-id before ‘.’ token

  • Scheduler.startLoop(loop2);*
  • ^*
    Tuesday_NotWorking5:49: error: a function-definition is not allowed here before ‘{’ token
    {
    ^
    Tuesday_NotWorking5:183: error: expected ‘}’ at end of input
    }
    ^
    exit status 1
    expected unqualified-id before ‘.’ token

ArduinoDom: ... using the scheduler.h function on my uno. First time I've used the scheduler function and it doesn't seem to like it. Can anyone figure out why?

I really don't know why you have problems reading and understanding plain English sentences. I'm German and don't have any problem to read and understand http://www.arduino.cc/en/Reference/Scheduler

The Scheduler library enables the Arduino Due to ...

It's a library for Arduino DUE ONLY, that's what I read and understand. Why do you think you might use different Arduino board with the scheduler library?

BTW: That scheduler library for DUE is pure bullshit, it's for cooperative multitasking only and has NOTHING to do with preemptive multitasking which is offered by modern operating systems. Microcontrollers are operated WITHOUT operating system and for coding cooperative multitasking on Arduino boards you don't need extra libraries like scheduler.

Thanks

@ArduinoDom

Alternatively you could try MOS (see footer). It works perfect for the UNO.

BTW: A cooperative scheduler is not necessarily bullshit, certainly not on 8 bit microcontrollers...

/Joe

Problem with the posted code is that there is no closing } at the end of setup.

If scheduler.h is due only, the compilation process didn't get far enough to complain about that.