| 39 | }); |
| 40 | |
| 41 | function do_action(str) { |
| 42 | switch (true) { |
| 43 | case /^to/.test(str): |
| 44 | console.log("• doing takeoff"); |
| 45 | client.takeoff(); |
| 46 | break; |
| 47 | case /^la/.test(str): |
| 48 | console.log("• doing land"); |
| 49 | client.land(); |
| 50 | break; |
| 51 | case /^st/.test(str): |
| 52 | console.log("• doing stop"); |
| 53 | client.stop(); |
| 54 | break; |
| 55 | case /^cw/.test(str): |
| 56 | console.log("• rotate clockwise"); |
| 57 | client.clockwise(0.5); |
| 58 | break; |
| 59 | case /^cc/.test(str): |
| 60 | console.log("• rotate counterclockwise"); |
| 61 | client.clockwise(-0.5); |
| 62 | break; |
| 63 | default: |
| 64 | console.log("• unknown command:" + str + ":"); |
| 65 | break; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | console.log('streaming from twitter...'); |
| 70 | stream.on('tweet', function (tweet) { |