cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Button operation in node red

Button operation in node red

RodrigoBG
New Poster
Hello everyone

I'm trying to make an application with node red and ctrlx that uses the dashboard 
to control the opening and closing of a door,
But I don't know how to reset the signal so I can do it continuously, any help? Thank you very much to everyone.
3 REPLIES 3

CodeShepherd
Community Moderator
Community Moderator

Could a bit more describe your application?

  • How is the door connected to the ctrlX CORE? E.g. simple Ethercat IO?
  • How does it need to commanded? E.g. a bit needs to be set and reset?

Feel free to check out our examples included in our node-red-contrib-ctrlx-automation that can be found on github and is also included in the ctrlX OS - Node-RED app itself.

Hello,

My application controls the opening and closing of some doors, the CtrlX core is connected via Ethernet to an I/O module, and the signals do not necessarily have to be set and reset, it can work well by holding it down until the door opens completely and the same for the closing.

The door is a stepper motor conected to a linear module, the stepper motor is controlled by a drive and the drive is controled by an output of the i/o module of the CtrlX core, the opening and closing of the dpprs is controlled through limit switches.

Thanks you so much.

 

 

As far as I know the dashboard has no "push button" functionality out of the box. But as end switches are used you could use

  • radio buttons like they are used in the above mentioned examples
  • start buttons for setting (staring movement) and if even needed stop for resetting (stopping movement)
  • create your own JavaScript button reacting to "touchstart", "mousedown" and "touchend", "mouseup" events
    See example code:
    [{"id":"eac5d9eb.958798","type":"ui_template","z":"e659d6d440bf877d","group":"61e6d4c4.e7619c","name":"momentary button","order":7,"width":"0","height":"0","format":"<div id=\"momentary\">\n   <md-button style=\"min-width:36px;\n                    width: 100%; \n                    height: 100%; \n                    margin:0; \n                    padding: 0px; \n                    border-radius: 50%; \n                    background-color:green\">\n       \n      <i class=\"fa fa-hand-pointer-o\"></i>\n   </md-button>\n</div>\n<script>\n(function($scope) {\n    \n$('#momentary').on('touchstart mousedown', function(e) {\n    e.preventDefault(); //prevent default behavior\n    $scope.send({\"topic\":\"momentary\",\"payload\": true});\n});\n\n$('#momentary').on('touchend mouseup', function(e) {\n    e.preventDefault(); //prevent default behavior\n    $scope.send({\"topic\":\"momentary\",\"payload\": false});\n});\n    \n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":650,"y":2840,"wires":[["534f375d.fce978"]]},{"id":"534f375d.fce978","type":"debug","z":"e659d6d440bf877d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":2840,"wires":[]},{"id":"61e6d4c4.e7619c","type":"ui_group","name":"TEST","tab":"d680797a.2f8b88","order":1,"disp":true,"width":"5","collapse":false,"className":""},{"id":"d680797a.2f8b88","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

 

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist