{"id":18817726,"url":"https://github.com/haroldpetersinskipp/node-dualshock-controller","last_synced_at":"2026-04-17T10:04:12.504Z","repository":{"id":44372977,"uuid":"512305765","full_name":"HaroldPetersInskipp/node-dualshock-controller","owner":"HaroldPetersInskipp","description":"updated fork of https://github.com/rdepena/node-dualshock-controller","archived":false,"fork":false,"pushed_at":"2022-07-10T02:25:45.000Z","size":68,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T02:27:00.284Z","etag":null,"topics":["api","bluetooth","dualshock","events","hid","node","node-dualshock-controller","node-hid","node-red","npm","playstation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HaroldPetersInskipp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-09T23:34:47.000Z","updated_at":"2022-07-10T00:46:33.000Z","dependencies_parsed_at":"2022-07-12T18:20:02.896Z","dependency_job_id":null,"html_url":"https://github.com/HaroldPetersInskipp/node-dualshock-controller","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaroldPetersInskipp%2Fnode-dualshock-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaroldPetersInskipp%2Fnode-dualshock-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaroldPetersInskipp%2Fnode-dualshock-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HaroldPetersInskipp%2Fnode-dualshock-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HaroldPetersInskipp","download_url":"https://codeload.github.com/HaroldPetersInskipp/node-dualshock-controller/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239753734,"owners_count":19691162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bluetooth","dualshock","events","hid","node","node-dualshock-controller","node-hid","node-red","npm","playstation"],"created_at":"2024-11-08T00:12:55.241Z","updated_at":"2026-04-17T10:04:12.466Z","avatar_url":"https://github.com/HaroldPetersInskipp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"node-dualshock-controller\n=========================\n\nThis project is an updated fork of [node-dualshock-controller](https://github.com/rdepena/node-dualshock-controller) An eventing API layer over HID for the Sony DualShock 3 and DualShock 4 controllers.\n\n# Installation:\nOnly a manual instalation of this package will work for right now.\n\nDownload the github repo with `git clone https://github.com/HaroldPetersInskipp/node-dualshock-controller.git`\n\nOr from [HERE](https://github.com/HaroldPetersInskipp/node-dualshock-controller/archive/refs/heads/main.zip).\n\nTo use with Node-RED, place the downloaded files in your `.node-red/node_modules` directory (usually located in the users home folder, it may be hidden by default).\n\nExtract the files.\n\nThen in your prefered terminal, navigate to the directory where you extracted the files and type `npm i` or `npm install`\n\n# Optional Instructions - Import flow.json into Node-Red\nThis flow is an example of the package being used to capture events from a Dualshock 4 controller for use in Node-RED.\n\nIt can be imported into the Node-Red editor using the `flow.json` file. The package must have been manually installed first.\n\nIn the Node-RED editor, select the `Import` menu option or press `ctrl-i` to bring up the import dialog.\n\nThe Import dialog can be used to import a flow by the following methods:\n\n    pasting in the flow JSON directly,\n    uploading a flow JSON file,\n    browsing the local flow library,\n    browsing the example flows provided by installed nodes.\n\nAfter pasting the contents of `flow.json` click the `Import` button and click `Deploy` to deploy the flow.\n\nThis example may save you some time starting a project, but doesn't do much else yet.\n\n## Using the DualShock library\n\n`Important: THE CONTROLLER WILL NOT SEND ANY DATA IF YOU DO NOT PRESS THE PS BUTTON.`\n\nAlso, to use the touchpad, rumble and LED capabilities of the controller you\nmust connect the controller to your computer using a micro-USB cable.\n\n~~~~ javascript\nlet dualShock = require('node-dualshock-controller');\n\n// pass options to init the controller.\nlet controller = dualShock({\n    //you can use a ds4 by uncommenting this line.\n    config: \"dualshock4-generic-driver\", \n    //if the above configuration doesn't work for you,\n    //try uncommenting the following line instead.\n    //config: \"dualshock4-alternate-driver\",  \n    //if using ds3 uncomment this line.\n    //config: \"dualShock3\",  \n    //smooths the output from the acelerometers (moving averages) defaults to true\n    accelerometerSmoothing: true, \n    //smooths the output from the analog sticks (moving averages) defaults to false\n    analogStickSmoothing: false,\n});\n\n// make sure you add an error event handler\ncontroller.on('error', err =\u003e console.log(err));\n\n// DualShock 4 control rumble and light settings for the controller\ncontroller.setExtras({\n  rumbleLeft:  0,   // 0-255 (Rumble left intensity)\n  rumbleRight: 0,   // 0-255 (Rumble right intensity)\n  red:         0,   // 0-255 (Red intensity)\n  green:       75,  // 0-255 (Blue intensity)\n  blue:        225, // 0-255 (Green intensity)\n  flashOn:     40,  // 0-255 (Flash on time)\n  flashOff:    10   // 0-255 (Flash off time)\n});\n\n// DualShock 3 control rumble and light settings for the controller\ncontroller.setExtras({\n  rumbleLeft:  0,   // 0-1 (Rumble left on/off)\n  rumbleRight: 0,   // 0-255 (Rumble right intensity)\n  led: 2 // 2 | 4 | 8 | 16 (Leds 1-4 on/off, bitmasked)\n});\n\n// add event handlers:\ncontroller.on('left:move', data =\u003e console.log('left Moved: ' + data.x + ' | ' + data.y));\ncontroller.on('right:move', data =\u003e console.log('right Moved: ' + data.x + ' | ' + data.y));\ncontroller.on('connected', () =\u003e console.log('connected'));\ncontroller.on('square:press', ()=\u003e console.log('square press'));\ncontroller.on('square:release', () =\u003e console.log('square release'));\n\n// sixasis motion events:\n// the object returned from each of the movement events is as follows:\n//{\n//    direction : values can be: 1 for right, forward and up. 2 for left, backwards and down.\n//    value : values will be from 0 to 120 for directions right, forward and up and from 0 to -120 for left, backwards and down.\n//}\n\n// DualShock 4 TouchPad\n// finger 1 is x1 finger 2 is x2\ncontroller.on('touchpad:x1:active', () =\u003e console.log('touchpad one finger active'));\ncontroller.on('touchpad:x2:active', () =\u003e console.log('touchpad two fingers active'));\ncontroller.on('touchpad:x2:inactive', () =\u003e console.log('touchpad back to single finger'));\ncontroller.on('touchpad:x1', data =\u003e console.log('touchpad x1:', data.x, data.y));\ncontroller.on('touchpad:x2', data =\u003e console.log('touchpad x2:', data.x, data.y));\n\n// right-left movement\ncontroller.on('rightLeft:motion', data =\u003e console.log(data));\n// forward-back movement\ncontroller.on('forwardBackward:motion', data =\u003e console.log(data));\n// up-down movement\ncontroller.on('upDown:motion', data =\u003e console.log(data));\n\n// controller status\n// as of version 0.6.2 you can get the battery %, if the controller is connected and if the controller is charging\ncontroller.on('battery:change', data =\u003e console.log(data));\ncontroller.on('connection:change', data =\u003e console.log(data));\ncontroller.on('charging:change', data =\u003e console.log(data));\n\n~~~~\n\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Ricardo de Pena\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharoldpetersinskipp%2Fnode-dualshock-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharoldpetersinskipp%2Fnode-dualshock-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharoldpetersinskipp%2Fnode-dualshock-controller/lists"}