You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
➜ Twitter-Sumobot git:(master) ✗ tessel run index.js
TESSEL! Connected to TM-00-04-f000da30-005c4f48-422c2586.
INFO Bundling directory /Users/frijol/Twitter-Sumobot
INFO Deploying bundle (442.50 KB)...
INFO Running script...
Connecting...
TypeError: Uncaught, unspecified "error" event.
at js_new (src/colony/lua/colony-init.lua:494)
at emit (src/colony/lua/colony-node.lua:703)
at _f (builtin/wifi-cc3000.js:136)
at <anonymous> (builtin/wifi-cc3000.js:40)
at connect (builtin/wifi-cc3000.js:40)
at checkConnection (/app/index.js:23)
at res (/app/index.js:10)
at run (src/colony/lua/colony-node.lua:1082)
at require (src/colony/lua/colony-node.lua:1077)
at res (/_start.js:4)
Code:
// Get Tessel connected to Wifivartessel=require('tessel');varwifi=require('wifi-cc3000');varwifiSettings={ssid: 'Gaumenkitzel',password: 'Gaumenkitzel',timeout: 40};checkConnection();wifi.on('disconnect',function(){console.log('Disconnected.');checkConnection();});functioncheckConnection(){if(wifi.isConnected()){console.log('Connected.');main();}else{console.log('Connecting...');wifi.connect(wifiSettings,function(err,res){if(err){console.log('Error connecting:',err);}checkConnection();});}}functionmain(){// Set up Twitterconsole.log('Setting up Twitter...');vartwitter=require('twitter');varutil=require('util');vartwit=newtwitter({consumer_key: 'O7oc0pvsZn4xjgcuHuYdX4FaC',consumer_secret: 'iJYuHFz2sD46Nvk3mcwzX8uih14aEAMgVWdWoR59nx8v6Zl7ZX',access_token_key: '2529232909-luARGU89K4CKFMvfzBjCgG6ubefzDkdDWkSB85i',access_token_secret: 'GXQfuzvGdjLEs3t1HEYfhQ9x9bdBcSBVXjBkbRgwYlOE0'});tessel.led[0].output(1);console.log('Twitter is all set up.');// Set up servosvarservoLib=require('servo-pca9685');varservo=servoLib.use(tessel.port['A']);// When servo module is ready...servo.on('ready',function(){console.log('Servo module ready. Listening for tweets...');tessel.led[1].output(1);// Stream tweets that mention the keywordtwit.stream('statuses/filter',{track:'#Tesselbot'},function(stream){stream.on('data',function(data){vartweet=data.text;console.log(tweet);if(tweet.indexOf('forward')>0){forward();}elseif(tweet.indexOf('back')>0){back();}elseif(tweet.indexOf('right')>0){right();}elseif(tweet.indexOf('left')>0){left();}else{// Anything not an explicit command makes it stopstop();}});stream.on('error',function(err){console.log('Twitter error:',err);});});});}// Motion functionsfunctionforward(){console.log('Moving: forward');servo.move(1,1);servo.move(2,0);}functionback(){console.log('Moving: back');servo.move(1,0);servo.move(2,1);}functionright(){console.log('Moving: right');servo.move(1,1);servo.move(2,1);}functionleft(){console.log('Moving: left');servo.move(1,0);servo.move(2,0);}functionstop(){console.log('Stopping.');servo.move(1,0.5);servo.move(2,0.5);}
The text was updated successfully, but these errors were encountered:
Code:
The text was updated successfully, but these errors were encountered: