Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. afick
    3. Topics
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Topics created by afick

    • afick

      using interrupt - cant back to void loop
      Development • • afick  

      7
      0
      Votes
      7
      Posts
      1360
      Views

      Yveaux

      @afick Sorry for my request for the full sketch -- for some reason I only saw your first post. Anyway, @mfalkvidd is right, you should not access the MySensors library (e.g. send messages) from an interrupt handler. That will certainly mess up things. What you could do is set e.g. a flag from the interrupt handler and check in the loop() function if this flag has been set. If so, send a message and clear the flag. E.g. (untested): static volatile bool pirChanged = false; static volatile bool pirTripped; void check_pir() { pirTripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; pirChanged = true; } void loop() { // .. your old code .. if (pirChanged) { send(msg.set(pirTripped ? "1" : "0")); // Send tripped value to gw pirChanged = false; } }
    • afick

      [SOLVED] Using interupt - partial
      Development • • afick  

      3
      0
      Votes
      3
      Posts
      881
      Views

      afick

      hmmm ok thanks. CASE CLOSED
    • afick

      [Branch][beta 2.0] GW with dallas temp not sending data to domoticz
      Troubleshooting • • afick  

      6
      0
      Votes
      6
      Posts
      1822
      Views

      mfalkvidd

      You are missing sendSketchInfo in presentation(). In presentation(), sensors.begin(); is run. In the example that line is in setup(). 3. This: sensors.setWaitForConversion(false); is missing. Not sure how much any of it matters, but maybe they are important.
    • afick

      [n00b]]Ethernet GW - without NF24
      My Project • • afick  

      31
      0
      Votes
      31
      Posts
      15184
      Views

      zaphodus

      I had the same problem as you and I have found a possible solution. The arduino has default auto reset on serial connection. So when you connect gateway to controller trough USB, the gateway is rebooting immediately and processing presentation(). In case of wireless gateway (esp8266) this does not happen. The presentation() runs only on startup of the gateway. I made little change in MyGatewayTransportEthernet.cpp and now the gateway processes presentation() when the controller is connecting to it. You can find here my solution: https://github.com/zaphodus/Arduino/commit/ce93db73513f1da45637b186787c9b2501e5d882