Skip to content

Tutorial | Sample 1

bl4z edited this page Dec 6, 2014 · 4 revisions

Connect to croosle

sample 1

open in jsfiddle

Be sure to set correct path to your socket server in External resources tab

To find out your croosle box ip address just run ifconfig from command line

root@raspberrypi:~/croosle# ifconfig
eth0 Link encap:Ethernet  HWaddr b8:27:eb:17:79:d3
inet addr:192.168.1.178  Bcast:192.168.1.255  Mask:255.255.255.0

In our case correct url would be http://192.168.1.178:7777/socket.io/socket.io.js

Next thing would be to start croosle server (npm start), Connect to sensortag unit, Subscribe to its sensors and Open io socket.

root@raspberrypi:~/croosle# npm start

> [email protected] start /root/croosle
> node croosle.js

   _____ _____   ____   ____   _____ _      ______
  / ____|  __ \ / __ \ / __ \ / ____| |    |  ____|
 | |    | |__) | |  | | |  | | (___ | |    | |__
 | |    |  _  /| |  | | |  | |\___ \| |    |  __|
 | |____| | \ \| |__| | |__| |____) | |____| |____
  \_____|_|  \_\\____/ \____/|_____/|______|______|

Commands:
h (help)
c (connect)
i (info)
p (print data)
r (read sensors)
s (subscribe to sensors)
db (write data to database)
io (open io socket)
d (Disconnect)
q (Quit)
x (Exit)

prompt: command:  c
searching
connecting
connect Thu Dec 04 2014 08:51:26 GMT+0000 (GMT)
uuid: 90:59:af:0:0:b:b:2f
enableIrTemperature
enableAccelerometer
enableHumidity
enableMagnetometer
enableBarometricPressure
enableGyroscope
prompt: command:  s
subscribed
prompt: command:  io
IO open

When all set, run code and data from sensortag should appear in jsfiddle result window.

Clone this wiki locally