Skip to content

Instantly share code, notes, and snippets.

@erdemarslan
Created February 17, 2020 21:22
Show Gist options
  • Save erdemarslan/24a42f1b0232b0da77f5065a67354b74 to your computer and use it in GitHub Desktop.
Save erdemarslan/24a42f1b0232b0da77f5065a67354b74 to your computer and use it in GitHub Desktop.
Read Raspberry Pi CPU Temperature on Node.js
var spawn = require('child_process').spawn;
temp = spawn('cat', ['/sys/class/thermal/thermal_zone0/temp']);
temp.stdout.on('data', function(data) {
console.log('Result: ' + data/1000 + ' degrees Celcius');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment