Skip to content

Commit fe9a2e0

Browse files
author
Jason Kridner
committed
BIG CHANGE: Made convienence variables global
I couldn't figure out an easy way to get access to these variables from functions within bonescript as long as they were local. For now, I'm changing the interface and assuming users will make these variables as globals.
1 parent 41f5a57 commit fe9a2e0

File tree

7 files changed

+26
-25
lines changed

7 files changed

+26
-25
lines changed

analog.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var bb = require('bonescript');
1+
require('bonescript');
22

3-
var inputPin = bone.P9_39;
4-
var outputPin = bone.P9_14;
3+
inputPin = bone.P9_39;
4+
outputPin = bone.P9_14;
55

66
setup = function() {
77
pinMode(outputPin, OUTPUT);
@@ -12,4 +12,4 @@ loop = function() {
1212
analogWrite(outputPin, value);
1313
};
1414

15-
bb.run();
15+
run(seutp, loop);

blinkled.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var bb = require('bonescript');
1+
require('bonescript');
22

3-
var ledPin = bone.P8_3;
4-
var ledPin2 = bone.USR3;
3+
ledPin = bone.P8_3;
4+
ledPin2 = bone.USR3;
55

66
setup = function() {
77
pinMode(ledPin, OUTPUT);
@@ -17,4 +17,4 @@ loop = function() {
1717
delay(1000);
1818
};
1919

20-
bb.run();
20+
run(setup, loop);

bone101.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
var bb = require('bonescript');
1+
require('bonescript');
22

33
setup = function() {
44
var server = new bb.Server(0, "bone101");
55
server.begin();
66
};
77

8-
bb.run();
8+
run(setup);

input.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var bb = require('bonescript');
1+
require('bonescript');
22

3-
var outputPin = bone.P8_3;
4-
var inputPin = bone.P8_5;
3+
outputPin = bone.P8_3;
4+
inputPin = bone.P8_5;
55

66
setup = function() {
77
console.log('Please connect ' + inputPin.key + ' to ' + outputPin.key +
@@ -21,4 +21,4 @@ loop = function() {
2121
delay(500);
2222
};
2323

24-
bb.run();
24+
run(setup, loop);

node_modules/bonescript/index.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parallel.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
var bb = require('bonescript');
1+
require('bonescript');
22

3-
var ledPin = bone.USR3;
4-
var outputPin = bone.P8_3;
5-
var eventPin = bone.P8_5;
6-
var ainPin = bone.P9_39;
7-
var pwmPin = bone.P9_14;
3+
ledPin = bone.USR3;
4+
outputPin = bone.P8_3;
5+
eventPin = bone.P8_5;
6+
ainPin = bone.P9_39;
7+
pwmPin = bone.P9_14;
88

99
setup = function() {
1010
console.log('Please connect ' + outputPin.key + ' to ' + eventPin.key +
@@ -38,4 +38,4 @@ loop = [
3838
}
3939
];
4040

41-
bb.run();
41+
run(setup, loop);

weatherstation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
var bb = require('bonescript');
2+
require('bonescript');
33
var fs = require('fs');
44
var io = require('socket.io');
55
var pconfig = require('./weatherstation/bmp085-pressure');
@@ -58,4 +58,4 @@ setup = function() {
5858
server.begin();
5959
};
6060

61-
bb.run();
61+
run(setup);

0 commit comments

Comments
 (0)