This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Digitise an older engine - ESP32
#44
(2023-03-26, 07:28 PM)Boatingbaileys Wrote: Interesting, I've just cleaned and complied mine and it seems to get past that stage ok. To confirm the code:

#include "sensesp/system/lambda_consumer.h"

//// Bilge Monitor /////

auto* bilge = new DigitalInputState(25, INPUT_PULLUP, 5000);

auto int_to_string_function = [](int input) ->String {
    if (input == 1) {
      return "Water present!";
    }
    else { // input == 0
      return "bilge clear";
    }
};

auto int_to_string_transform = new LambdaTransform<int, String>(int_to_string_function);

bilge->connect_to(int_to_string_transform)
      ->connect_to(new SKOutputString("propulsion.engine.bilge"));

bilge->connect_to(new SKOutputString("propulsion.engine.bilge.raw"));

Is 'input' used anywhere else on your code? I'll have another look through this tomorrow to see if I can spot anything else.

Thanks,

It seems that:
Code:
#include "sensesp/transforms/lambda_transform.h"
needs to be added, and neither of us had that in our code, but you had:
Code:
#include "sensesp/transforms/linear.h"
which itself references  "lambda_transform.h" and therefore it worked for you but not for me.  It might be a good idea to add it just incase someone else steals your code like I did!!

thanks for this work!
Reply


Messages In This Thread
RE: Digitise an older engine - ESP32 - by MigGat - 2022-03-24, 10:11 AM
RE: Digitise an older engine - ESP32 - by Sailoog - 2022-03-25, 08:08 PM
RE: Digitise an older engine - ESP32 - by Paul M - 2022-03-26, 03:22 PM
RE: Digitise an older engine - ESP32 - by PaddyB - 2022-03-28, 11:30 AM
RE: Digitise an older engine - ESP32 - by PaddyB - 2022-03-26, 09:21 PM
RE: Digitise an older engine - ESP32 - by Sailoog - 2022-03-31, 11:59 AM
RE: Digitise an older engine - ESP32 - by tYuoAz - 2022-04-01, 10:40 PM
RE: Digitise an older engine - ESP32 - by Paul M - 2022-09-13, 03:03 PM
RE: Digitise an older engine - ESP32 - by SCarns - 2022-04-04, 03:48 PM
RE: Digitise an older engine - ESP32 - by MigGat - 2022-04-03, 06:08 PM
RE: Digitise an older engine - ESP32 - by MigGat - 2023-03-25, 01:18 AM
RE: Digitise an older engine - ESP32 - by Techstyle - 2023-03-27, 06:40 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)