Skip to content

Commit

Permalink
Clean up temperature examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Aug 8, 2015
1 parent 56c6508 commit b9c0603
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions eg/temperature-ds18b20.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ five.Board().on("ready", function() {
pin: 2
});

temperature.on("data", function(err, data) {
console.log(data.celsius + "°C", data.fahrenheit + "°F");
temperature.on("data", function() {
console.log(this.celsius + "°C", this.fahrenheit + "°F");
console.log("0x" + this.address.toString(16));
});
});
Expand Down
6 changes: 3 additions & 3 deletions eg/temperature-dual-ds18b20.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ five.Board().on("ready", function() {
});


temperatureA.on("data", function(err, data) {
console.log("A", data.celsius + "°C", data.fahrenheit + "°F");
temperatureA.on("data", function() {
console.log("A", this.celsius + "°C", this.fahrenheit + "°F");
});

temperatureB.on("data", function(err, data) {
console.log("B", data.celsius + "°C", data.fahrenheit + "°F");
console.log("B", this.celsius + "°C", this.fahrenheit + "°F");
});
});

Expand Down
4 changes: 2 additions & 2 deletions eg/temperature-lm335.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ five.Board().on("ready", function() {
pin: "A0"
});

temperature.on("data", function(err, data) {
console.log(data.celsius + "°C", data.fahrenheit + "°F");
temperature.on("data", function() {
console.log(this.celsius + "°C", this.fahrenheit + "°F");
});
});

Expand Down
4 changes: 2 additions & 2 deletions eg/temperature-lm35.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ five.Board().on("ready", function() {
pin: "A0"
});

temperature.on("data", function(err, data) {
console.log(data.celsius + "°C", data.fahrenheit + "°F");
temperature.on("data", function() {
console.log(this.celsius + "°C", this.fahrenheit + "°F");
});
});

Expand Down
6 changes: 4 additions & 2 deletions eg/temperature-tmp36.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ five.Board().on("ready", function() {
pin: "A0"
});

temperature.on("data", function(err, data) {
console.log(data.celsius + "°C", data.fahrenheit + "°F");
var sensor = new five.Sensor("A5");

temperature.on("data", function() {
console.log(this.celsius + "°C", this.fahrenheit + "°F");
});
});

Expand Down

0 comments on commit b9c0603

Please sign in to comment.