Hi all, i’m received my cores just three days ago.
First of all - i’ve tried to use Web IDE and went to local compiling, because web IDE is really horrible to use - not telling anything correctly about errors in compilation…
So my plan is to connect Spark Core to Spacebrew which running on node.js server.
Spacebrew is a great project to connect all of things together, i’m already using it in BeagleBone and Raspberry Pi projects. It’s working on websockets, and guys, who develop it already created Arduino library, which allow to connect Arduino with ethernet shield and Spacebrew server.
So i’ve took this library and tried to port it to Spark. And now i have a problem - when Core tries to connect with node.js it’s reboots. As i found in debugging proccess - it’s reboots in Base64Encode operation.
Is there any existing base64encode libraries, which will work on Spark Core?
I’m trying to use exactly this And on base64encode i’ve got something like reboot of of Core, but it’s not starting my program again, just breathing light of connection to cloud…
then in the middle of file this enum SBType goes in functions etc.
But when i try to Verify this project - web IDE says to me, that SBtype is undefined on line 5,6 and 7 … but there is nothing in that lines… As i said before - web ide can be usable, if verifier will show code, that it’s verifies…
This is what exactly says Verifier :
In file included from spacebrew.cpp:1:0:
spacebrew.h:5:35: error: use of enum ‘SBType’ without previous declaration
spacebrew.h:6:35: error: use of enum ‘SBType’ without previous declaration
…
Oh, that might be my fault. Right now the web IDE runs the pre-processor against .h and .cpp files, something I’m going to disable early next week so that things more closely match what people are used to with Arduino. I’m guessing it’s adding function declarations for you above that enum statement. To disable that, try adding this to the .h and .cpp files:
I’m still in trying to create websockets library. Faced a problem.
When i’m sending websocket handshake like:
“GET / HTTP/1.1”,
“Upgrade: WebSocket”,
“Connection: Upgrade”,
“Host: 192.168.1.146”,
“Sec-WebSocket-Origin: SparkWebSocketClient”,
“Sec-WebSocket-Version: 13”,
“Sec-WebSocket-Key: 1VTFj/CydlBCZDucDqw8eA==”,
"Sec-WebSocket-Protocol: ",
“HTTP/1.1 101”
By line with tcpclient.prinln() - i’ve got “400 Bad request”. In network monitor i see that there is a lot of frames, which are holding this lines separately.
When i look into browsers request in network monitor i’m seeing 1 frame with whole lines inside. So what i do:
OK, resolved this problem with sending by println one by one correct handshake.
But faced with same problem later.
My client sending
{“config”:{“name”:“Spark_Core1”,“description”:“Test build”,“publish”:{“messages”:[{“name”:“Start”,“type”:“boolean”,“default”:“false”}]},“subscribe”:{“messages”:[{“name”:“Start”,“type”:“boolean”},{“name”:“Stop”,“type”:“boolean”}]}}}
with just tcpclient.println(message);
on network monitor i see this:
TCPPayloadData: Binary Large Object (19 Bytes)
And there is no answers on this from Node.js. So i think node just didn’t understood what saying core.
How can i send long chars and not be interpreted as binary?