-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspeed.js
More file actions
60 lines (38 loc) · 1.39 KB
/
speed.js
File metadata and controls
60 lines (38 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// var myInt =
// setInterval(function () {
// console.log("Hello");
// }, 1000);
// This example file is meant to give you an idea of some of the basic
// Sphero commands. Refer to this when solving activities 1 & 2.
var sphero = require('./sphero.js');
var ctx = require('axel');
setInterval(function() {
// Clear the terminal
ctx.clear();
// Sets the pixel BG color to green
ctx.bg(0,255,0);
// Draws a line into the console
ctx.line(1,1,10,10);
}, 100);
// First step is to connect to Sphero
// sphero.connect(function() {
// sphero.roll(200,30)
// });
// // This example file is meant to give you an idea of some of the basic
// // Sphero commands. Refer to this when solving activities 1 & 2.
// var sphero = require('./sphero.js');
// // First step is to connect to Sphero
// sphero.connect(function() {
// // Move Sphero a distance of 200 units at an angle of 90 degrees
// sphero.roll(200,90)
// // Get Sphero's color
// console.log("Sphero's current color is: " + sphero.getColor());
// // Change Sphero's color
// sphero.setColor('blue');
// // Verify Sphero's color has changed
// console.log("Sphero's current color is: " + sphero.getColor());
// // Use the Odometer to find Sphero's position in format [x,y]
// console.log(sphero.readOdometer());
// // Check if Sphero's state is what is expected
// sphero.assertState(0, 200, 'blue');
// });