Jump to content

Ghostchips

Members
  • Posts

    4869
  • Joined

  • Days Won

    5

Posts posted by Ghostchips

  1. 9 minutes ago, kiwi808 said:

    Just curious about what it’s for? 13b into B2000?

    Also, why not use a renesis gearbox?

    I do not have a renesis gearbox.  And there might be a B2000 available very affordably.
    Truth is i'd rather put it in my van, but a B2000 is available..

    • Like 1
  2. Swapping 'int' to 'int volatile' would compile but did the same refusal to read & print temp unless something else in the system changed.

    As for the coils getting pos+ feed in that last diagram.  That's a legacy of when i tried coil on plug igniter things (which worked) but for some reason when i swapped those out for soemthing else, it wouldn't spark if the igbt were on the low side.  Not enough volts to trip them maybe?

    Seems i fixed the thermal reading code by added a random "Serial.print ( C = ) at the end of the loop for the resetting thermal value & add a 0.5 second delay (i hate that, it seems noobsh but then i am new...).

  3. 59 minutes ago, IvyMike said:

    Random guess: try prefixing " int thermoSensorNewVal, thermoSensorOldVal;" with "volatile".

    Also, does the arduino share a common ground with the 12V boost converter?

    Shares earth via 330ohm resistor.  Much less it doeens't function right.

  4. Don't fall into the trap of thinking you need perfection if you know it ran well before.
    Some engines builders scoff at me for saying this but... There have been many people who build engines with pitting in the bore.
    One guy bored 90 thou' oversize and still had some pitting. He calls those pits "oil retention dimples" now.

    1 mm oversize should cure the worst of it.

    (This is only my advice and i cannot recommend pistons to fit as i know nothing of the pin height ect of said engine)

    • Like 3
  5. Also.  Is the reason this works with a pair of double A batteries but the arduino fires all the coils at once something to do with ground float?  And how would i fix it?957193043_circuitcoilinsulatedgate.jpg.72e9c91edade88e833e7b14c09e91fbf.jpg

    Forgot to say the arduino has 'fast shitty diodes' on the output pins.

    Think i toyed with a heavy resistor from the arduino ground to main ground in the past but it wasn't happy?  can't remember.

  6. And now for combining it with something that doesn't work well when i added that code Ned helped with.

     

    #include <max6675.h>
    #include <SoftwareSerial.h>

    SoftwareSerial mySerial(10, 11);

    int soPin = 12;// SO=Serial Out
    int csPin = 13;// CS = chip select CS pin
    int sckPin = A1;// SCK = Serial Clock pin

    MAX6675 thermoSensor(sckPin, csPin, soPin);

    int thermoSensorNewVal, thermoSensorOldVal;  // an attempt to add zoomcats potentometer test to thermosensor

    #define TEMP_BAND     2
    #define TEMP_MINOR    60
    #define TEMP_GENERAL  75
    #define TEMP_DIRE     90
    #define INCR_MINOR    (TEMP_MINOR + TEMP_BAND)
    #define INCR_GENERAL  (TEMP_GENERAL + TEMP_BAND)
    #define INCR_DIRE     (TEMP_DIRE + TEMP_BAND)

    #define DECR_IDLE     (TEMP_MINOR - TEMP_BAND)
    #define DECR_MINOR    (TEMP_GENERAL - TEMP_BAND)
    #define DECR_GENERAL  (TEMP_DIRE - TEMP_BAND)

    enum warningStates_t {IDLE = 0, WARN_MINOR, WARN_GENERAL, WARN_DIRE};
    warningStates_t curState, oldState;

    int buttonPause = 3;
    int buttonVolPlus = 2;
    int buttonVolMinus = 4;

    # define ACTIVATED LOW

    boolean isPlaying = false;

    const int  buttonPin = 6;    // the pin that the pushbutton is attached to
    const int  buttonPin2 = 7;    // the pin that the pushbutton is attached to
    const int  buttonPin3 = 8;    // the pin that the pushbutton is attached to
    const int  buttonPin4 = 9;    // the pin that the pushbutton is attached to
    const int  buttonPin5 = 5;
    // the pin that the pushbutton is attached to
    // Variables will change:
    int buttonPushCounter = 0;   // counter for the number of button presses
    int buttonState = 0;         // current state of the button
    int lastButtonState = 0;     // previous state of the button
    int buttonPushCounter2 = 0;   // counter for the number of button presses
    int buttonState2 = 0;         // current state of the button
    int lastButtonState2 = 0;     // previous state of the button
    int buttonPushCounter3 = 0;   // counter for the number of button presses
    int buttonState3 = 0;         // current state of the button
    int lastButtonState3 = 0;     // previous state of the button
    int buttonPushCounter4 = 0;   // counter for the number of button presses
    int buttonState4 = 0;         // current state of the button
    int lastButtonState4 = 0;     // previous state of the button
    int buttonPushCounter5 = 0;   // counter for the number of button presses
    int buttonState5 = 0;         // current state of the button
    int lastButtonState5 = 0;     // previous state of the button


    void setup() {
      Serial.begin(9600);  
      Serial.println("Robojax MAX6675");

    # define Start_Byte 0x7E
    # define Version_Byte 0xFF
    # define Command_Length 0x06
    # define End_Byte 0xEF
    # define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]

    # define ACTIVATED LOW

    boolean isPlaying = false;


    pinMode(buttonPause, INPUT);
    digitalWrite(buttonPause,HIGH);
    // initialize the button pin as a input:
    pinMode(buttonVolPlus, INPUT);
    digitalWrite(buttonVolPlus,HIGH);
    // initialize the button pin as a input:
    pinMode(buttonVolMinus, INPUT);
    digitalWrite(buttonVolMinus,HIGH);
    // initialize the button pin as a input:
     
    pinMode(buttonPin, INPUT);
    // initialize the button pin as a input:
    pinMode(buttonPin2, INPUT);
    // initialize the button pin as a input:
    pinMode(buttonPin3, INPUT);
    // initialize the button pin as a input:
    pinMode(buttonPin4, INPUT);
    // initialize the button pin as a input:
    pinMode(buttonPin5, INPUT);
    // initialize the button pin as a input:

      mySerial.begin (9600);
      delay(1000);
      execute_CMD(0x06, 0, 0x12);   // Set the volume between 0-30 (0x00~0x30)//
      execute_CMD(0x03, 0, 0x0002);    //file to play at system start-up//
      isPlaying = true;

     

    }


    void loop()
    {
      thermoSensorNewVal = thermoSensor.readCelsius();

      if (thermoSensorNewVal != thermoSensorOldVal) {
        Serial.print(" C = ");
        Serial.print(thermoSensorNewVal);

        thermoSensorOldVal = thermoSensorNewVal;
      }

      switch (curState) {
        default:            curState = IDLE;  /* should never happen, but good practice to have a default */
        case IDLE:          if (thermoSensorNewVal >= INCR_MINOR)   curState = WARN_MINOR;    break;

        case WARN_MINOR:    if (thermoSensorNewVal <= DECR_IDLE)    curState = IDLE;
          if (thermoSensorNewVal >= INCR_GENERAL) curState = WARN_GENERAL;  break;

        case WARN_GENERAL:   if (thermoSensorNewVal <= DECR_MINOR)   curState = WARN_MINOR;
          if (thermoSensorNewVal >= INCR_DIRE)    curState = WARN_DIRE;     break;

        case WARN_DIRE:     if (thermoSensorNewVal <= DECR_GENERAL) curState = WARN_GENERAL;  break;
      }

      if (curState > oldState) {
        // Increased temp warnings
        switch (curState) {
          case WARN_MINOR:    playThermalExceed();   break;
          case WARN_GENERAL:  playHeatLevelCrit(); break;
          case WARN_DIRE:     playMeltdownImminent();    break;
          default:            break;  /* should never happen, but good practice to have a default */
        }
      }

      if (curState < oldState) {
        // Decreased temp warnings
        switch (curState) {
          case IDLE:          /* Could do an 'all clear' message here */    break;
          case WARN_MINOR:    playThermalExceed();   break;
          case WARN_GENERAL:  playHeatLevelCrit(); break;
          default:            break;  /* should never happen, but good practice to have a default */
            }
      }

      oldState = curState;

      // read the pushbutton input pin:
      buttonState = digitalRead(buttonPin);

      // compare the buttonState to its previous state
      if (buttonState != lastButtonState) {
        // if the state has changed, increment the counter
        if (buttonState == HIGH) {
          // if the current state is HIGH then the button went from off to on:
          buttonPushCounter++;
          playEngineEnabled();
        } else {
          // if the current state is LOW then the button went from on to off:
          playShuttingDown();
        }
        // Delay a little bit to avoid bouncing
        delay(20);
      }
      // save the current state as the last state, for next time through the loop
      lastButtonState = buttonState;

      // read the pushbutton input pin:
      buttonState2 = digitalRead(buttonPin2);

      // compare the buttonState to its previous state
      if (buttonState2 != lastButtonState2) {
        // if the state has changed, increment the counter
        if (buttonState2 == HIGH) {
          // if the current state is HIGH then the button went from off to on:
          buttonPushCounter2++;
          playLightAmpEngaged();
        } else {
          // if the current state is LOW then the button went from on to off:
          playButtonOff();
        }
        // Delay a little bit to avoid bouncing
        delay(20);
      }
      // save the current state as the last state, for next time through the loop
      lastButtonState2 = buttonState2;

      buttonState3 = digitalRead(buttonPin3);
      // compare the buttonState to its previous state
      if (buttonState3 != lastButtonState3) {
        // if the state has changed, increment the counter
        if (buttonState3 == HIGH) {
          // if the current state is HIGH then the button went from off to on:
          buttonPushCounter++;
          playLightAmp2Engaged();
        } else {
          // if the current state is LOW then the button went from on to off:
          playButtonOff();
        }
        // Delay a little bit to avoid bouncing
        delay(20);
      }
      // save the current state as the last state, for next time through the loop
      lastButtonState3 = buttonState3;

      // read the pushbutton input pin:
      buttonState4 = digitalRead(buttonPin4);

      // compare the buttonState to its previous state
      if (buttonState4 != lastButtonState4) {
        // if the state has changed, increment the counter
        if (buttonState4 == HIGH) {
          // if the current state is HIGH then the button went from off to on:
          buttonPushCounter4++;
          playEXcamEngaged();
        } else {
          // if the current state is LOW then the button went from on to off:
          playButtonOff();
        }
        // Delay a little bit to avoid bouncing
        delay(20);
      }
      // save the current state as the last state, for next time through the loop
      lastButtonState4 = buttonState4;

        // read the pushbutton input pin:
      buttonState5 = digitalRead(buttonPin5);

      // compare the buttonState to its previous state
      if (buttonState5 != lastButtonState5) {
        // if the state has changed, increment the counter
        if (buttonState5 == HIGH) {
          // if the current state is HIGH then the button went from off to on:
          buttonPushCounter5++;
          playPhoneChargePort();
        } else {
          // if the current state is LOW then the button went from on to off:
          playButtonOff();
        }
        // Delay a little bit to avoid bouncing
        delay(20);
      }
      // save the current state as the last state, for next time through the loop
      lastButtonState5 = buttonState5;

     if (digitalRead(buttonPause) == ACTIVATED)
      {
        if(isPlaying)
        {
          pause();
          isPlaying = false;
        }else
        {
          isPlaying = true;
          play();
        }
      }

     if (digitalRead(buttonVolPlus) == ACTIVATED)
      {
        if(isPlaying)
        {
          setVolumeUp();
        }
      }

      if (digitalRead(buttonVolMinus) == ACTIVATED)
      {
        if(isPlaying)
        {
          setVolumeDown();
        }
      }
    } // end of loop?

    void playThermalExceed()
    {
      Serial.println(" Thermal Exceeded Triggered Once ");
      execute_CMD(0x03, 0, 0x000c);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void playHeatLevelCrit()
    {
      Serial.println(" Heat Critical Triggered Once ");
      execute_CMD(0x03, 0, 0x000a);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void playMeltdownImminent()
    {
      Serial.println(" Meltdown Triggered Once ");
      execute_CMD(0x03, 0, 0x000b);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void playHeatModerate()
    {
      Serial.println(" HeatModerate Once ");
      execute_CMD(0x03, 0, 0x000d);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void playHeatNominal()
    {
      Serial.println(" HeatNominal Triggered Once ");
      execute_CMD(0x03, 0, 0x000e);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void pause()
    {
      execute_CMD(0x0E,0,0);
      delay(500);
    }

    void play()
    {
      execute_CMD(0x0D,0,1);
      delay(500);
    }

    void playNext()
    {
      execute_CMD(0x01,0,1);
      delay(50);
    }

    void playPrevious()
    {
      execute_CMD(0x02,0,1);
      delay(50);
    }

    void setVolumeUp()
    {
      execute_CMD(0x04, 0, 1); // Set the volume (0x00~0x30)
      delay(50);
    }

    void setVolumeDown()
    {
      execute_CMD(0x05, 0, 1); // Set the volume (0x00~0x30)
      delay(50);
    }

    void setVolume(int volume) //Specify volume using code. Not applicable to the normal button interface.
    {
      execute_CMD(0x06, 0, volume); // Set the volume (0x00~0x30)
      delay(2000);
    }

    void playEngineEnabled()
    {
      execute_CMD(0x03, 0, 0x0006);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(1500);
    }

    void playLightAmpEngaged()
    {
      execute_CMD(0x03, 0, 0x0004);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(2200);
    }

    void playLightAmp2Engaged()
    {
      execute_CMD(0x03, 0, 0x0005);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(2500);
    }

    void playEXcamEngaged()
    {
      execute_CMD(0x03, 0, 0x0007);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(2500);
    }

    void playShuttingDown()
    {
      execute_CMD(0x03, 0, 0x0003);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(600);
    }

    void playPhoneChargePort()
    {
      execute_CMD(0x03, 0, 0x0009);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(1500);
    }

    void playButtonOff()
    {
      execute_CMD(0x03, 0, 0x0008);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(400);
    }

    void execute_CMD(byte CMD, byte Par1, byte Par2)
    // Excecute the command and parameters
    {
      // Calculate the checksum (2 bytes)
      word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
      // Build the command line
      byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge,
                                Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte
                              };
      //Send the command line to the module
      for (byte k = 0; k < 10; k++)
      {
        mySerial.write( Command_line[k]);
      }
    }

  7. Not a snowballs change in hell of me figuring out how to use google drive.  Google really does need to be dragged outside, beaten & shot.  And the corpse thrown in a volcano while people chant & beat drums.  How they can make something that unintuitive i don't know.  Who thought having buttons that aren't visible & don't have any known function was a good idea?  It's like point & click lucky dip & not every action is repeatable.  Just like things i build in real life....

    Ok the thing in the spoiler should be code that worked.

     

    #include <max6675.h>
    #include <SoftwareSerial.h>

    SoftwareSerial mySerial(10, 11);

    int soPin = 12;// SO=Serial Out
    int csPin = 13;// CS = chip select CS pin
    int sckPin = A1;// SCK = Serial Clock pin

    MAX6675 thermoSensor(sckPin, csPin, soPin);

    int thermoSensorNewVal, thermoSensorOldVal;  // an attempt to add zoomcats potentometer test to thermosensor

    #define TEMP_BAND     2
    #define TEMP_MINOR    60
    #define TEMP_GENERAL  75
    #define TEMP_DIRE     90
    #define INCR_MINOR    (TEMP_MINOR + TEMP_BAND)
    #define INCR_GENERAL  (TEMP_GENERAL + TEMP_BAND)
    #define INCR_DIRE     (TEMP_DIRE + TEMP_BAND)

    #define DECR_IDLE     (TEMP_MINOR - TEMP_BAND)
    #define DECR_MINOR    (TEMP_GENERAL - TEMP_BAND)
    #define DECR_GENERAL  (TEMP_DIRE - TEMP_BAND)

    enum warningStates_t {IDLE = 0, WARN_MINOR, WARN_GENERAL, WARN_DIRE};
    warningStates_t curState, oldState;

    int buttonPause = 3;
    int buttonVolPlus = 2;
    int buttonVolMinus = 4;

    # define ACTIVATED LOW

    boolean isPlaying = false;

    void setup() {
      Serial.begin(9600);  
      Serial.println("Robojax MAX6675");

    # define Start_Byte 0x7E
    # define Version_Byte 0xFF
    # define Command_Length 0x06
    # define End_Byte 0xEF
    # define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]

    # define ACTIVATED LOW

    boolean isPlaying = false;


      pinMode(buttonPause, INPUT);
      digitalWrite(buttonPause,HIGH);
      // initialize the button pin as a input:
      pinMode(buttonVolPlus, INPUT);
      digitalWrite(buttonVolPlus,HIGH);
      // initialize the button pin as a input:
      pinMode(buttonVolMinus, INPUT);
      digitalWrite(buttonVolMinus,HIGH);
      // initialize the button pin as a input:
     

      mySerial.begin (9600);
      delay(1000);
      execute_CMD(0x06, 0, 0x12);   // Set the volume between 0-30 (0x00~0x30)//
      execute_CMD(0x03, 0, 0x0002);    //file to play at system start-up//
      isPlaying = true;

     

    }


    void loop()
    {
      thermoSensorNewVal = thermoSensor.readCelsius();

      if (thermoSensorNewVal != thermoSensorOldVal) {
        Serial.print(" C = ");
        Serial.print(thermoSensorNewVal);

        thermoSensorOldVal = thermoSensorNewVal;
      }

      switch (curState) {
        default:            curState = IDLE;  /* should never happen, but good practice to have a default */
        case IDLE:          if (thermoSensorNewVal >= INCR_MINOR)   curState = WARN_MINOR;    break;

        case WARN_MINOR:    if (thermoSensorNewVal <= DECR_IDLE)    curState = IDLE;
          if (thermoSensorNewVal >= INCR_GENERAL) curState = WARN_GENERAL;  break;

        case WARN_GENERAL:   if (thermoSensorNewVal <= DECR_MINOR)   curState = WARN_MINOR;
          if (thermoSensorNewVal >= INCR_DIRE)    curState = WARN_DIRE;     break;

        case WARN_DIRE:     if (thermoSensorNewVal <= DECR_GENERAL) curState = WARN_GENERAL;  break;
      }

      if (curState > oldState) {
        // Increased temp warnings
        switch (curState) {
          case WARN_MINOR:    playThermalExceed();   break;
          case WARN_GENERAL:  playHeatLevelCrit(); break;
          case WARN_DIRE:     playMeltdownImminent();    break;
          default:            break;  /* should never happen, but good practice to have a default */
        }
      }

      if (curState < oldState) {
        // Decreased temp warnings
        switch (curState) {
          case IDLE:          playHeatNominal();/* Could do an 'all clear' message here */    break;
          case WARN_MINOR:       break;
          case WARN_GENERAL:  playHeatModerate(); break;
          default:            break;  /* should never happen, but good practice to have a default */
            }
      }

      oldState = curState;
      delay(200);

     if (digitalRead(buttonPause) == ACTIVATED)
      {
        if(isPlaying)
        {
          pause();
          isPlaying = false;
        }
        else
        {
          isPlaying = true;
          play();
        }
      }
     
     if (digitalRead(buttonVolPlus) == ACTIVATED)
      {
        if(isPlaying)
        {
          setVolumeUp();
        }
      }

      if (digitalRead(buttonVolMinus) == ACTIVATED)
      {
        if(isPlaying)
        {
          setVolumeDown();
        }
      }
    } // end of loop?

    void playThermalExceed()
    {
      Serial.println(" Thermal Exceeded Triggered Once ");
      execute_CMD(0x03, 0, 0x000c);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void playHeatLevelCrit()
    {
      Serial.println(" Heat Critical Triggered Once ");
      execute_CMD(0x03, 0, 0x000a);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void playMeltdownImminent()
    {
      Serial.println(" Meltdown Triggered Once ");
      execute_CMD(0x03, 0, 0x000b);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void playHeatModerate()
    {
      Serial.println(" HeatModerate Once ");
      execute_CMD(0x03, 0, 0x000d);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void playHeatNominal()
    {
      Serial.println(" HeatNominal Triggered Once ");
      execute_CMD(0x03, 0, 0x000e);    //file between 0-2999 in main folder. Doesn't love folders.//
      delay(500);
    }

    void pause()
    {
      execute_CMD(0x0E,0,0);
      delay(500);
    }

    void play()
    {
      execute_CMD(0x0D,0,1);
      delay(500);
    }

    void playNext()
    {
      execute_CMD(0x01,0,1);
      delay(50);
    }

    void playPrevious()
    {
      execute_CMD(0x02,0,1);
      delay(50);
    }

    void setVolumeUp()
    {
      execute_CMD(0x04, 0, 1); // Set the volume (0x00~0x30)
      delay(50);
    }

    void setVolumeDown()
    {
      execute_CMD(0x05, 0, 1); // Set the volume (0x00~0x30)
      delay(50);
    }

    void setVolume(int volume) //Specify volume using code. Not applicable to the normal button interface.
    {
      execute_CMD(0x06, 0, volume); // Set the volume (0x00~0x30)
      delay(2000);
    }

    void execute_CMD(byte CMD, byte Par1, byte Par2)
    // Excecute the command and parameters
    {
      // Calculate the checksum (2 bytes)
      word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
      // Build the command line
      byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge,
                                Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte
                              };
      //Send the command line to the module
      for (byte k = 0; k < 10; k++)
      {
        mySerial.write( Command_line[k]);
      }
    }

  8. Wanted to re-use some expensive gear oil with less than 100KM on it.  Was full of glitter.

    Tried running it through a funnel on top of a pipe filled with rope.  No luck.
    Cut the top off an oil filter and put it in a funnel with a magnet on the bottom, that caught the big chunks but there's fine bronze glitter oozing through the filter. (repco brand)

    Aside from tell me that engine oil filters aren't that picky & let through some stuff i wouldn't want in my engine, what else should i strain the oil through?
    Doesn't seem to wick uphill and back down into a container through a rope.  Appears too thick for that.

  9. OK, so i have started to blend 2 codes together and found something odd.
    The temp' reading won't update-read a new value unless one of the other input pins is changing state & performing an action based on it.
    May i send someone the code for them to see what's going on & tell me what i did wrong?   I suspect it's something to do with needing brackets or a "while run" type thing.  But i really don't know.

  10. "Ready to restore"  That's good, i don't have to leave it outside for decades in order to get it ready for restoration.  Someones' done it all for me.

    "No I'm going to fix it one day" is one thing.
    "No. i'm not going to fix it" is another you sometimes hear.

    • Like 1
  11. One of those gives me looping readouts of the temp falling warnings, Neds one looks good but i wasn't sure where to put the defines.

    No matter where they go, i get this

    "thermo_Neds_code:47:2: error: invalid preprocessing directive #ï

     #define TEMP_BAND     2

      ^
    exit status 1
    invalid preprocessing directive #ï"

    am i missing a library or something?

  12. That sort of worked, it's now triggering them every time it goes past the deadband range but that's ok, i just opened it up a bit (like 10 degrees.  Man this thing is crude).

    Added serial write for testing.  It gives the same warnings s the temp' falls.
    I don't want to sound like a spoonfeed bludger but what could i do to give different warnings as the temp falls compared to rises?

    • Like 1
  13. void loop() {
    
       Serial.print(" C = "); 
       Serial.print(thermoSensor.readCelsius());
    
       
       
       delay (1000);
       thermoSensorNewVal = (thermoSensor.readCelsius());
       
       if (thermoSensorNewVal < (thermoSensorOldVal-1)  ||  thermoSensorNewVal > (thermoSensorOldVal+1)) //dead band
       {
        
       if(thermoSensorNewVal >= 24.00)
        {
           tempWarningMinor();
        }
       if(thermoSensorNewVal >= 28.00)
        {
           tempWarningGeneral();
        }
       if(thermoSensorNewVal >= 32.00)
        {
           tempWarningDire();
        }
       }
      thermoSensorOldVal = thermoSensorNewVal;
    }

    This activates warning when the temp rises or falls by 4 degrees in one second.
    But that's not what i was aiming for.  I wanted a warning when it was between a certain range of degrees, but not to give that warning over & over, say if the temp rose by one degree but was still in the range of that same warning.

    What am i doing wrong, and how would i fix it?

    I suspect the warnings would have to be replaced with some kind of variable?  And that would have to run once every time it was selected instead of every loop.  Or maybe i'm going about this all wrong.

    Or in short
    "temp zone, do nothing until reading reaches value 80 plus or minus 10 degrees
    is temp exceeds or drops beyond 80, adjust to a value of 6, plus or minus 10 degrees and give warning"

    But i don't know how to write that in code..

×
×
  • Create New...