Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Feature Requests
  3. Sketch Generator

Sketch Generator

Scheduled Pinned Locked Moved Feature Requests
11 Posts 6 Posters 5.5k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • hekH Offline
    hekH Offline
    hek
    Admin
    wrote on last edited by
    #2

    Yes, it is still on the long-term roadmap.

    The amount of time I can put on the MySensors project (during nights/weekends) is the limiting factor here.

    1 Reply Last reply
    0
    • mfalkviddM Online
      mfalkviddM Online
      mfalkvidd
      Mod
      wrote on last edited by
      #3

      I guess we have a bit of chicken-and-egg problem here. People who can create such a tool don't need it, since they're already comfortable enough with programming. People who need such a tool aren't good enough at programming to create the tool.

      Open projects often rely on people scratching their own itch.

      We can't (and shouldn't) rely on hek doing everything. Could we maybe come up with good motivation factors? Or find people who want to scratch this itch?

      1 Reply Last reply
      0
      • TD22057T Offline
        TD22057T Offline
        TD22057
        Hardware Contributor
        wrote on last edited by
        #4

        I definitely fall in the "don't need it/don't want it" category. But - if I was going to try and design something like that, I'd think about building a "standard" set of component classes (Switch, Led, Relay, etc) and use a state machine style interface. The user then doesn't need to worry about how an item works, just which items they need to construct. The documentation for each class would explain how to wire it up and the user would create an instance of each class with the pins it's attached to and supply a callback function which would get called when the state of that item gets changed. So the user is just responsible for filling in the "what happens when things change" portion of the code. The main loop function would be a series of poll commands to each item. I've used that kind of design in my own sensors and it's a nice way to separate the hardware code (pins, polling) from the sensor code (what happens when the state changes). I think something like that could help with basic needs - obviously it wouldn't help much with complicated sensor behavior. It does still require coding - but not coding that cares about low level arduino stuff.

        I haven't put anything up on github yet but I could do that if anyone is interested in them. I have fully documented classes with wiring guides for a Switch (low or high, digital or analog pin), Timer (simple polling trigger), DigitalOutput (used for LED's and relays including blinking), and articulated water valve.

        Here's an example of a callback in my leak detector test case (no MS messages in this one) to give you an example of what this kind of code looks like. What I like about this kind of design is that the real work in the state change code has nothing do with hardware, pins, bit flags, etc. In 5 years when I've forgotten all of that stuff, I can still look at this and see exactly what's going on. The g_xxx variables are the globals for the Switch, Led, etc.

        void
        statusChange( Status status )
        {
           if ( status == g_status )
           {
              return;
           }
        
        #ifdef DEBUG_LEAK
           Serial.print( "Status  -> " ); Serial.println( status );
        #endif   
           
           switch( status )
           {
           case NORMAL:
              // Going back to normal operations.  Turn off the LED and open
              // the valve.
              g_led.off();
              g_valve.open();
        
              // TODO: send message, leak cleared.
              break;
              
           case LEAK:
              // Leak in secondary sensor - don't close the valves.
              g_led.blinkSlow();
        
              // TODO: send message, leak, valves opened
              break;
        
           case LEAK_SHUTOFF:
              // Leak in primary sensor - close the valves.
              g_valve.close();
              g_led.blinkFast();
        
              // TODO: send message, leak, valves closing
              break;
           }
        
           g_status = status;
        }
        
        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by hek
          #5

          @TD22057

          Yes, had the same thought..

          Even described it a bit under "Helper Classes" here:
          https://docs.google.com/document/d/1NKq5uuNdnxF5jWnum7VT32mbKLjuvqlx2A5D1qQ-H3Q/edit#heading=h.t5sdmpn6jz2i

          Feel free to add/edit/tweak in your ideas in the document.

          Having these building blocks makes it much easier to generate the code.

          1 Reply Last reply
          1
          • N Offline
            N Offline
            nftrix
            wrote on last edited by
            #6

            I fall into the "not enough skills to program" category, and like many others are just getting my feet wet. Sadly as I read some of the above and review the code, it doesn't all make sense nor do I understand how to utilize the building blocks provided.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              alfredocdmiranda
              wrote on last edited by
              #7

              @nftrix , I have always thought about it. So, after read this thread I started to build a tool that I don't know if it is what you want but I am trying to make easier the development of new nodes (compile and upload too).

              So, feel free if you want to take a look and give some feedback.

              https://github.com/alfredocdmiranda/mysbox/tree/development

              hekH 1 Reply Last reply
              2
              • A alfredocdmiranda

                @nftrix , I have always thought about it. So, after read this thread I started to build a tool that I don't know if it is what you want but I am trying to make easier the development of new nodes (compile and upload too).

                So, feel free if you want to take a look and give some feedback.

                https://github.com/alfredocdmiranda/mysbox/tree/development

                hekH Offline
                hekH Offline
                hek
                Admin
                wrote on last edited by
                #8

                @alfredocdmiranda

                Cool. If you create something usable, we could throw it up on the main site with a web frontend.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  alfredocdmiranda
                  wrote on last edited by
                  #9

                  Nice @hek ! I've just released version 0.1, so I think who has at minimum of dev skills, it is an usable tool. I would like that someone could test it.

                  https://github.com/alfredocdmiranda/mysbox

                  When I get something more usable for who doesn't have such that skills, I will let you know. :)

                  1 Reply Last reply
                  0
                  • lrtsenarL Offline
                    lrtsenarL Offline
                    lrtsenar
                    wrote on last edited by
                    #10

                    If you are interested, here is my beginning of work :

                    http://forum.mysensors.org/topic/2537/device-library

                    1 Reply Last reply
                    1
                    • mfalkviddM Online
                      mfalkviddM Online
                      mfalkvidd
                      Mod
                      wrote on last edited by
                      #11

                      It is not a generator, but @tonberg's framework might be useful for someone looking for a code generator.

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      14

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular