Toy kitchen stove simulation - slow PWM

Hi everybody,

New to arduino and programming. Upgrading Barbies kitchen and want to simulate IR stove - with minimum control - off, with maximum - continuosly lit, in between - PWM with variable DC and Frequency abt 0.2 Hz (5 sec period). Also there are 2 hotplates and one oven - any chance they can work simultaneously?
I was looking for for similar solutions ready to use, but so far without success - please give me ideas! Thanks in advance!!!

Why do you believe PWM at 0.2 Hz is needed to simulate a stove burner glow?

Also there are 2 hotplates and one oven - any chance they can work simultaneously?

Yes, the Arduino Uno has 6 PWM outputs and they each can have their own PWM value.

If you want to control the brightness with pots, of course you'll need to use 3 analog inputs for that.

Untested.

unsigned long stepTime = 20; // dim speed
unsigned long currentMillis, prevLed1Millis, prevLed2Millis, prevLed3Millis;
const byte pot1Pin = A0, pot2Pin = A1, pot3Pin = A2; // the three pot pins
const byte led1Pin = 9, led2Pin = 10, led3Pin = 11; // the three LED pins
int pot1Value, pot2Value, pot3Value;
int led1Value, led2Value, led3Value;

void setup() {
  pinMode(led1Pin, OUTPUT);
  pinMode(led2Pin, OUTPUT);
  pinMode(led3Pin, OUTPUT);
}

void loop() {
  currentMillis = millis(); // update with every loop
  pot1Value = analogRead(pot1Pin);
  if (pot1Value != led1Value && currentMillis - prevLed1Millis >= stepTime) { // if not the same, and time is up
    if (pot1Value > led1Value)led1Value++; // if pot is more, add to led value
    else(led1Value--); // if less, subtract
    analogWrite(led1Pin, led1Value >> 2); // write result to LED
    prevLed1Millis = millis(); // update
  }
  pot2Value = analogRead(pot2Pin);
  if (analogRead(pot2Pin) != led2Value && currentMillis - prevLed2Millis >= stepTime) {
    if (pot2Value > led2Value)led2Value++;
    else(led2Value--);
    analogWrite(led2Pin, led2Value >> 2);
    prevLed2Millis = millis();
  }
  pot3Value = analogRead(pot3Pin);
  if (analogRead(pot3Pin) != led3Value && currentMillis - prevLed3Millis >= stepTime) {
    if (pot3Value > led3Value)led3Value++;
    else(led3Value--);
    analogWrite(led3Pin, led3Value >> 2);
    prevLed3Millis = millis();
  }
}

Ken..

avr_fred:
Why do you believe PWM at 0.2 Hz is needed to simulate a stove burner glow?

Hi Fred!

I want to simulate the way my real stove is working: it turns on and off for short or prolonged time with ptriod of abt 5-10 sec, depending of power set.

We understand you want to slowly change the PWM value (dimming), not the actual PWM frequency.
Leo..

DVDdoug:
Yes, the Arduino Uno has 6 PWM outputs and they each can have their own PWM value.

If you want to control the brightness with pots, of course you'll need to use 3 analog inputs for that.

I don't want to control brightness. I want it full lit say 1 sec of 5 at low setting and pro rata 4 of 5 sec up to full lit, when I turn power pot.

Also i plan to use Pro Mini in final project.

Wawa:
We understand you want to slowly change the PWM value (dimming), not the actual PWM frequency.
Leo..

Hi Wawa,

Thank you for the code - first part is definitly works. But second part - and its most difficult for me - as yoy sad - just dimming leds. This is my mistake - I mislead you guys with PWM, but in fact the process I need is very slow PWM like. So as I feel - after reading pot value shoul be mapped from 0 to full cycle length (5 sec not strict) and led shold be lit to corresponding number of mills. Something like this.

I need something like this, but withiut delay:

pot1Value = analogRead(pot1Pin);
  pot1Value = map(pot1Value, 0, 1023, 0, 5000);
  digitalWrite(led1Pin, HIGH);
  delay (pot1Value);
  digitalWrite(led1Pin, LOW);
  delay (5000 - pot1Value);

This is not full project - some other functions are planned for MW, lights kettle etc, therefore would be great if full period will be easy to adjust.

That we don't call PWM. That's called blinking.

See "blink without delay" on how to do it for a single LED without blocking, you can easily expand that to multiple LEDs.

If I understand this correctly, you want to fade a LED to max brightness, but the fade time has to be controlled with a pot. When the stove knob is on low, the fade-in time should be long (but to max brightness), and when the knob is on full, the fade-in time to max brightness should be short.
Try this. It also has a (fixed) fade-out time.
Make sure you have no other delays (or slow serial printing) in the rest of your code.
Leo..

const int led1ShortFadeValue = 10, led1LongFadeValue = 100; // adjust times to suit
const int led2ShortFadeValue = 10, led2LongFadeValue = 100;
const int led3ShortFadeValue = 10, led3LongFadeValue = 100;
unsigned long led1Time, led2Time, led3Time;
unsigned long currentMillis, prevLed1Millis, prevLed2Millis, prevLed3Millis, FadeOutTime = 10;
const byte pot1Pin = A0, pot2Pin = A1, pot3Pin = A2; // the three pot pins
const byte led1Pin = 9, led2Pin = 10, led3Pin = 11; // the three LED pins
int pot1Value, pot2Value, pot3Value;
int led1Value, led2Value, led3Value;
byte threshold = 50; // pot off threshold

void setup() {
  pinMode(led1Pin, OUTPUT);
  pinMode(led2Pin, OUTPUT);
  pinMode(led3Pin, OUTPUT);
}

void loop() {
  currentMillis = millis(); // update with every loop
  pot1Value = analogRead(pot1Pin); // read pot
  led1Time = map (pot1Value, threshold, 1023, led1LongFadeValue, led1ShortFadeValue); // map potvalue to fadetime values
  led1Time = min(led1Time, led1LongFadeValue); // constrain, pot output not lower than that value
  if (pot1Value > threshold) { // if stove is turned on
    if (led1Value < 255 && currentMillis - prevLed1Millis >= led1Time) {
      led1Value++; // increase brightness one step
      analogWrite(led1Pin, led1Value); // write to LED
      prevLed1Millis = millis(); // update
    }
  } else { // if stove is turned off
    if (led1Value > 0 && currentMillis - prevLed1Millis >= FadeOutTime) {
      led1Value--; // decrease brightness one step
      analogWrite(led1Pin, led1Value); // write to LED
      prevLed1Millis = millis(); // update
    }
  }
  pot2Value = analogRead(pot2Pin);
  led2Time = map (pot2Value, threshold, 1023, led2LongFadeValue, led2ShortFadeValue);
  led2Time = min(led2Time, led2LongFadeValue);
  if (pot2Value > threshold) {
    if (led2Value < 255 && currentMillis - prevLed2Millis >= led2Time) {
      led2Value++;
      analogWrite(led2Pin, led2Value);
      prevLed2Millis = millis();
    }
  } else {
    if (led2Value > 0 && currentMillis - prevLed2Millis >= FadeOutTime) {
      led2Value--;
      analogWrite(led2Pin, led2Value);
      prevLed2Millis = millis();
    }
  }
  pot3Value = analogRead(pot3Pin);
  led3Time = map (pot3Value, threshold, 1023, led3LongFadeValue, led3ShortFadeValue);
  led3Time = min(led3Time, led3LongFadeValue);  
  if (pot3Value > threshold) {
    if (led3Value < 255 && currentMillis - prevLed3Millis >= led3Time) {
      led3Value++;
      analogWrite(led3Pin, led3Value);
      prevLed3Millis = millis();
    }
  } else {
    if (led3Value > 0 && currentMillis - prevLed3Millis >= FadeOutTime) {
      led3Value--;
      analogWrite(led3Pin, led3Value);
      prevLed3Millis = millis();
    }
  }    
}

Many thanks Wawa for new code, appreciate your help indeed.
This is not what I meant, but now I'm thinking to use it for oven with slow heating up and cooling.

For what I meant I managed to write on basis "BlinkWithoutDelay" following code, which working (for one LED so far) - please have a look if it can be optimized anyway.

const int led1Pin =  13;      // the number of the LED pin
const byte pot1Pin = A0;
const long interval = 5000;           // interval at which to blink (milliseconds)

int led1State = LOW;             // ledState used to set the LED
unsigned long previousMillis = 0;        // will store last time LED was updated
long Led1On = 0;
int pot1Value;

void setup() {
  // set the digital pin as output:
  pinMode(led1Pin, OUTPUT);
}

void loop() {
  // here is where you'd put code that needs to be running all the time.

  unsigned long currentMillis = millis();
  
  pot1Value = analogRead(pot1Pin); // read pot
  Led1On = map(pot1Value, 0, 1023, 0, interval); // map pot to interval
  if (currentMillis - previousMillis >= Led1On) led1State = LOW; // unlit hot plate if time came
  if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis;// Start new interval
  if (Led1On > 10) led1State = HIGH; } // lit hot plate in begining of new intereval if switch is on
 
     // set the LED with the ledState of the variable:
    digitalWrite(led1Pin, led1State);
  
}

Lots of comments on style.

  1. variable names: use descriptive names. Not led1 but hotPlateLed, same for pot1 and more such names. Makes it much easier to remember what is what.
  2. start newline after a { and place very } on its own line. Otherwise it's very hard to follow what belongs to what.
  3. use informative comments, remove superfluous and obvious ones.

So your code becomes (I didn't change the names - I did needed the help of the IDE to untangle it):

void loop() {
  unsigned long currentMillis = millis();
  pot1Value = analogRead(pot1Pin);
  Led1On = map(pot1Value, 0, 1023, 0, interval);
  if (currentMillis - previousMillis >= Led1On) {
    led1State = LOW;
  }
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis; // Start new interval
    if (Led1On > 10) {
      led1State = HIGH;
    }
  }
  digitalWrite(led1Pin, led1State);
}

And I still don't really understand what's supposed to be going on here with the LED...

Thanx Wawa and wvmarle for your valuable advices!

The Hot Plate Led is:

  • off, when pot on 0 or close to 0
  • 1 sec on and 4 sec off, when pot is on 20% power
    ...
  • 3 sec on and 2 sec off, when pot is on 60% power
    ...
  • constantly lit, when pot is on 100% power

I'm currently working of full project code, basing on "SeveralThingsAtTheSameTime" example in begining of this section, which includes:

  • hot plates control as above
  • oven control as above or using your second code
  • MW Oven control - when button is pressed - the chamber is lit, plate starts rotating and countdown starts on 7seg indicator from 9 to 0, then all stops and and beep sounds.

Additional functions planned (though non-arduino related, but to give ideas to any possible followers:

  • reed switch controlled kettle giving sound effect of boiling and whistling once placed on plate, using sound recording / playback board
  • round-running water from tap, using small pump and reservoir
  • main switch, also controlling spot lights
  • clock
  • power outlets for possible additional appliances (blender etc.)

And I came to another question or, to be honest, questions:

  • I plan to use Pro Mini, but testing everything on Uno - any difference / problem?
  • since I already run out of pins with 7seg - can I use also pins 0 and 1 and any restrictions for same?
  • alternatively, I can use analog input pin for button input - is there any "standard solution" for same?
  • how to make PWM for MW motor without stopping other processes? "Blink" motor?
  • same as above for "beeping"?

Also I will appreciate any comments / suggestions from everybody, who came across regarding full project or any part of it.

RustSPb:

  • I plan to use Pro Mini, but testing everything on Uno - any difference / problem?

No - other than the power supply. The Mini has a much smaller regulator so can't handle high voltages well. Best powered on 5V, e.g. a mobile phone adapter. Same can be used for the LEDs.

  • since I already run out of pins with 7seg - can I use also pins 0 and 1 and any restrictions for same?

Yes, can use; but you'll lose the Serial debugging as those are the Tx and Rx pins.

  • alternatively, I can use analog input pin for button input - is there any "standard solution" for same?

All analog pins (except A6 and A7 - available on the Pro Mini but not the Uno) can act as digital pin just fine, so can be used as digital input, digital output, and analog input. A6 and A7 are analog input only. A4 and A5 are also used by I2C - which may come in play if you start working with port expanders.

For your project it may make sense to add a second Arduino; after all the processes don't depend on one another so no need to communicate between them.

  • how to make PWM for MW motor without stopping other processes? "Blink" motor?

Use analogWrite() on a PWM enabled pin (check the manual).

  • same as above for "beeping"?

Use the tone() and noTone() functions.

Thanks again wvmarle for great help! Now I can finalize project!
Good news about A0-A4! How to address them in code:

const byte LedPin = A4;
pinMode(A4, OUTPUT);
digitalWrite(A4, HIGH); ?

I prefer to continue with one, partly due to space restriction within furniture, partly to learn more about arduino and combining processes.

Meahwhile I stuck a bit with switch case function - here is part of my code controlling microwave:

void readMWButton() {

     // this only reads the button state after the button interval has elapsed
     //  this avoids multiple flashes if the button bounces
     // every time the button is pressed it changes buttonLed_State causing the Led to go on or off
     // Notice that there is no need to synchronize this use of millis() with the flashing Leds
 
 if (millis() - previousMWButtonMillis >= MWButtonInterval) {

   if (digitalRead(MWButtonPin) == HIGH) {
     MWOn = true;            // switching on MW oven
     MWSwitchOnMillis = millis(); // fixing MW on time
     // Switch on MW light
     // Switch on MW motor
    
     previousMWButtonMillis += MWButtonInterval;
   }
 }

}

//========================================

void UpdateMWState () {

  if (MWOn = true) {
       
    currentMillis = millis();
    MWMillisOn = currentMillis - MWSwitchOnMillis;
        
    switch (MWMillisOn) {
     
     case MWMillisOn < 1000:
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //9
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;

     case MWMillisOn < 2000:
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //8
       digitalWrite(pinE, B0);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;
     
     case MWMillisOn < 3000:
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B1);    //7
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B1);
     break;
     
     case MWMillisOn < 4000:
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B1);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //6
       digitalWrite(pinE, B0);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;
     
     case MWMillisOn < 5000:
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B1);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //5
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;
     
     case MWMillisOn < 6000:
       digitalWrite(pinA, B1);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B1);    //4
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;
     
     case MWMillisOn < 7000:
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //3
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B0);
     break;
     
     case MWMillisOn < 8000:
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B1);
       digitalWrite(pinD, B0);    //2
       digitalWrite(pinE, B0);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B0);
     break;
     
     case MWMillisOn < 9000:
       digitalWrite(pinA, B1);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B1);    //1
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B1);
     break;
     
     case MWMillisOn < 10000:
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //0
       digitalWrite(pinE, B0);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B1);
     break;

    case MWMillisOn >= 10000:
      MWOn = false; // switching off MW oven
      // Switch off MW light
      // Switch off MW motor
       digitalWrite(pinA, B1);
       digitalWrite(pinB, B1);
       digitalWrite(pinC, B1);
       digitalWrite(pinD, B1);    //0
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B1);     
    break;
  
}
  }
  else {}
}

while compiling it gives some strange errors from which I understand, that I screwed up with syntax completely((( Please help!

The pin handling is correct.

The switch/case statement not: you can not use comparisons in the cases. Must be numbers the variable in switch is compared to. Like this:

switch (ledToLight) {
  case 1: 
    digitalWrite(led[1], HIGH);
    break;

  case 2:
    digitalWrite(led[2], HIGH);
    break;
}

For what you're trying to do, you have to use regular if/else blocks.

Here is full code so far, but when compiling I'm getting following error:

exit status 1
'updateMWState' was not declared in this scope

What does it mean? updateMWState is a function...

// ----------LIBRARIES--------------



// --------CONSTANTS (Input / Output)---------------

  const byte HP1PotPin = A0, HP2PotPin = A1, OvenPotPin = A3; // the three pot pins
  const int MWButtonPin = 9; // MW On button Pin

  const int HP1LedPin =  13, HP2LedPin = 12, OvenLedPin = 11, MWLedPin = 0, MWBeepPin = 1, MWMotorPin = 10;      // the pin numbers for the LEDs and buzzer
  
  const int pinA = 5; //                            --5--
  const int pinB = 6; //                         4 |     | 6                                                    
  const int pinC = 8; //                           |--2--|                                               
  const int pinD = 3; //                         7 |     | 8                                          
  const int pinE = 7; //                            --3--                                                 
  const int pinF = 4;                                                      
  const int pinG = 2;

  const int MWButtonInterval = 300; // number of millisecs between button readings
  const long HPinterval = 5000; // interval at which to blink (milliseconds)
  const int OvenLedShortFadeValue = 10, OvenLedLongFadeValue = 100; // adjust times to suit


//------------ VARIABLES (will change)---------------------

  int HP1PotValue, HP2PotValue, OvenPotValue;
  byte MWButtonState = LOW;

  unsigned long currentMillis = 0;    // stores the value of millis() in each iteration of loop()
  unsigned long previousHP1Millis = 0, previousHP2Millis = 0,previousOvenMillis = 0, previousMWButtonMillis = 0, MWSwitchOnMillis, MWMillisOn;   // will store last time function was updated
  unsigned long OvenFadeOutTime = 10;

  int HP1LedState = LOW, HP2LedState = LOW; // ledState used to set the LED
  int HP1LedOntime = 0, HP2LedOntime = 0, OvenLedOntime = 0; // period within "interval", when Led is on
  int OvenLedValue = 0; // Oven Led ratio

  byte PotThreshold = 50; // pot off threshold

  boolean MWOn = false;

//========================================

void setup() {

  //Serial.begin(9600);
  //Serial.println("Starting SeveralThingsAtTheSameTimeRev1.ino");  // so we know what sketch is running
  
  // set the Stove Led pins as output:
  pinMode(HP1LedPin, OUTPUT);
  pinMode(HP2LedPin, OUTPUT);
  pinMode(OvenLedPin, OUTPUT);
  pinMode(MWLedPin, OUTPUT);
  

  // set the 7seg indicator pins as output:

  pinMode(pinA, OUTPUT);
  pinMode(pinB, OUTPUT);
  pinMode(pinC, OUTPUT);
  pinMode(pinD, OUTPUT);                         
  pinMode(pinE, OUTPUT);
  pinMode(pinF, OUTPUT);
  pinMode(pinG, OUTPUT);
  
  // set the button pin as input with a pullup resistor to ensure it defaults to HIGH
  
  pinMode(MWButtonPin, INPUT);
  
  
 
}

//========================================

void loop() {
 
  readMWButton();               // call the functions that do the work
  updateMWState();
  updateHPStates();
  updateOvenState();
}

//========================================

void readMWButton() {

     // this only reads the button state after the button interval has elapsed
     //  this avoids multiple flashes if the button bounces
     // every time the button is pressed it changes buttonLed_State causing the Led to go on or off
     // Notice that there is no need to synchronize this use of millis() with the flashing Leds
 
 if (millis() - previousMWButtonMillis >= MWButtonInterval) {

   if (digitalRead(MWButtonPin) == HIGH) {
     MWOn = true;            // switching on MW oven
     MWSwitchOnMillis = millis(); // fixing MW on time
     digitalWrite(MWLedPin, HIGH);
     analogWrite(MWMotorPin, 50);
    
     previousMWButtonMillis += MWButtonInterval;
   }
 }

}

//========================================

void UpdateMWState() {

  if (MWOn = true) {
       
    currentMillis = millis();
    MWMillisOn = currentMillis - MWSwitchOnMillis;
     
     if (MWMillisOn < 1000) {
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //9
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;}

     if (MWMillisOn < 2000){
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //8
       digitalWrite(pinE, B0);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;}
     
     if (MWMillisOn < 3000){
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B1);    //7
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B1);
     break;}
     
     if (MWMillisOn < 4000){
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B1);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //6
       digitalWrite(pinE, B0);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;}
     
     if (MWMillisOn < 5000){
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B1);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //5
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;}
     
     if (MWMillisOn < 6000){
       digitalWrite(pinA, B1);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B1);    //4
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B0);
     break;}
     
     if (MWMillisOn < 7000){
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //3
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B0);
     break;}
     
     if (MWMillisOn < 8000){
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B1);
       digitalWrite(pinD, B0);    //2
       digitalWrite(pinE, B0);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B0);
     break;}
     
     if (MWMillisOn < 9000){
       digitalWrite(pinA, B1);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B1);    //1
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B1);
     break;}
     
     if (MWMillisOn < 10000){
       digitalWrite(pinA, B0);
       digitalWrite(pinB, B0);
       digitalWrite(pinC, B0);
       digitalWrite(pinD, B0);    //0
       digitalWrite(pinE, B0);
       digitalWrite(pinF, B0);
       digitalWrite(pinG, B1);
     break;}

    if (MWMillisOn >= 10000){
      MWOn = false; // switching off MW oven
      digitalWrite(MWLedPin, LOW);
      analogWrite(MWMotorPin, 0);
      tone(MWBeepPin, 1000, 1000);
       digitalWrite(pinA, B1);
       digitalWrite(pinB, B1);
       digitalWrite(pinC, B1);
       digitalWrite(pinD, B1);    //
       digitalWrite(pinE, B1);
       digitalWrite(pinF, B1);
       digitalWrite(pinG, B1);     
    break;}
  
}
  }
  else {}
}

UpdateMWState (loop) and updateMWState (function).
One with a capital 'U' and the other with a lower case 'u'.
Leo..

Wow!!! Capital/noncapital makes sense!!!

But now same thing with next function inspite I made copy/paste for all names!

exit status 1
'updateHPStates' was not declared in this scope

Here is balance of the code

//========================================

void updateHPStates() {
  
  currentMillis = millis();
  
  HP1potValue = analogRead(HP1potPin); // read pot value for HP1
  HP2potValue = analogRead(HP2potPin); // read pot value for HP2  
  
  HP1LedOntime = map(HP1potValue, 0, 1023, 0, HPinterval); // map pot value to HPinterval
  HP2LedOntime = map(HP2potValue, 0, 1023, 0, HPinterval); // map pot value to HPinterval
  
  if (currentMillis - previousHP1Millis >= HP1LedOntime) HP1ledState = LOW; // unlit hot plate 1 if time came
  if (currentMillis - previousHP2Millis >= HP2LedOntime) HP2ledState = LOW; // unlit hot plate 2 if time came
  
  if (currentMillis - previousHP1Millis >= HPinterval) 
  { 
    previousHP1Millis = currentMillis;// Start new interval
    if (HP1LedOntime > PotThreshold) HP1LedState = HIGH; 
    } // lit hot plate 1 in begining of new intereval if switch is on
  
  if (currentMillis - previousHP2Millis >= HPinterval) 
  { 
    previousHP2Millis = currentMillis;// Start new interval
    if (HP2LedOntime > PotThreshold) HP2LedState = HIGH; 
    } // lit hot plate 2 in begining of new intereval if switch is on
 
  digitalWrite(HP1ledPin, HP1LedState);
  digitalWrite(HP2ledPin, HP2LedState);
}

// ===================================================

void updateOvenState() {
  
  currentMillis = millis(); // update with every loop
  
  OvenPotValue = analogRead(OvenPotPin); // read pot
  OvenLedOntime = map (OvenPotValue, PotThreshold, 1023, OvenLedLongFadeValue, OvenLedShortFadeValue); // map potvalue to fadetime values
  OvenLedOntime = min(OvenLedOntime, OvenLedLongFadeValue); // constrain, pot output not lower than that value
  
  if (OvenPotValue > PotThreshold) { // if stove is turned on
    if (OvenLedValue < 255 && currentMillis - previousOvenMillis >= OvenLedOntime) {
      OvenLedValue++; // increase brightness one step
      analogWrite(OvenLedPin, OvenLedValue); // write to LED
      previousOvenMillis = millis(); // update
    }
  } else { // if stove is turned off
    if (OvenLedValue > 0 && currentMillis - previousOvenMillis >= OvenFadeOutTime) {
      OvenLedValue--; // decrease brightness one step
      analogWrite(OvenLedPin, OvenLedValue); // write to LED
      previousOvenLedMillis = millis(); // update
    }
  }
  
}

It's pretty hard to try out your code if it comes in bits and pieces. There being apparent overlaps between pieces makes it nigh impossible.
Why don't you just post the whole, unaltered sketch in one go, including the complete error message(s)?