Skip to content

Instantly share code, notes, and snippets.

@mrodem
Created September 11, 2017 12:19
Show Gist options
  • Save mrodem/7d277d32704de5a16ecba10bdf8ee45a to your computer and use it in GitHub Desktop.
Save mrodem/7d277d32704de5a16ecba10bdf8ee45a to your computer and use it in GitHub Desktop.
const PythonShell = require('python-shell');
// Assumes that pc-nrfutil exists in $CWD/python/pc-nrfutil
const options = {
mode: 'text',
cwd: `${__dirname}/python/pc-nrfutil`,
args: [
'-v',
'dfu',
'ble',
'-f',
'--package',
'/path/to/sdk13/examples/dfu/ble_dfu_send_hex/test_images_update_nrf52832/dfu_test_softdevice_bootloader_s132.zip',
'-ic',
'NRF52',
'--port',
'/dev/ttyACM1'
]
};
const script = 'nordicsemi/__main__.py';
const shell = new PythonShell(script, options);
shell.on('message', function (message) {
console.log(message);
});
shell.on('error', function (error) {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment