Skip to content

Commit

Permalink
Change "var" (variables definition) to "const"
Browse files Browse the repository at this point in the history
  • Loading branch information
rasp753 committed Jan 30, 2020
1 parent 84e70da commit a8cfc7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions examples/adxl345/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import GROVEACCELEROMETER from "https://unpkg.com/@chirimen/grove-accelerometer?
main();

async function main() {
var ax = document.getElementById("ax");
var ay = document.getElementById("ay");
var az = document.getElementById("az");
var i2cAccess = await navigator.requestI2CAccess();
var port = i2cAccess.ports.get(1);
var groveaccelerometer = new GROVEACCELEROMETER(port, 0x53);
const ax = document.getElementById("ax");
const ay = document.getElementById("ay");
const az = document.getElementById("az");
const i2cAccess = await navigator.requestI2CAccess();
const port = i2cAccess.ports.get(1);
const groveaccelerometer = new GROVEACCELEROMETER(port, 0x53);
await groveaccelerometer.init();
for (;;) {
try {
var values = await groveaccelerometer.read();
const values = await groveaccelerometer.read();
ax.innerHTML = values.x ? values.x : ax.innerHTML;
ay.innerHTML = values.y ? values.y : ay.innerHTML;
az.innerHTML = values.z ? values.z : az.innerHTML;
Expand Down
8 changes: 4 additions & 4 deletions node-examples/adxl345/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const sleep = promisify(setTimeout)
main();

async function main() {
var i2cAccess = await requestI2CAccess();
var port = i2cAccess.ports.get(1);
var groveaccelerometer = new GROVEACCELEROMETER(port, 0x53);
const i2cAccess = await requestI2CAccess();
const port = i2cAccess.ports.get(1);
const groveaccelerometer = new GROVEACCELEROMETER(port, 0x53);
await groveaccelerometer.init();
for (;;) {
try {
var values = await groveaccelerometer.read();
const values = await groveaccelerometer.read();
console.log(`ax: ${values.x}, ax: ${values.y}, ax: ${values.z}`)
} catch (err) {
console.error("READ ERROR:" + err);
Expand Down

0 comments on commit a8cfc7e

Please sign in to comment.