I have a Photon that I want to communicate with a computer. I want to transmit data at about 50 hz, a few bytes at a time. Currently, I’m using TCP to connect between my laptop’s hotspot to the photon. The setup works fine with my computer (HP Probook 4540) , but for other laptops (Lenovo Yoga) it does not work well. Ultimately, I want to communicate between a photon and a computer on the same WiFi network. I’ve tried doing this by using my phone’s hotspot, but could not get it to work. I am at a loss for what to do.
For reference, the code I’m using is very similar to the TCP server code sample provided in the documentation.
This appears to be a good solution, but I’m having trouble running the line “node livegraph.js --login user password”. I get the following error message:
“(node:16700) UnhandledPromiseRejectionWarning: TypeError: storage.setItemSync is not a function
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:16700) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16700) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.”
That fixes the error message. However, I still cannot get the plots to work in chrome. Is there something I’m missing?
Edit: The photon is sending the devicerequest event over and over again, but it is not sending out data.
Edit2: It is a similar issue that post 14 in Local server in node.js example faces
Edit 3: Fixed the issue. The issue was connecting the photon to the network created by my laptop’s hotspot. Connecting it to my home network along with the laptop fixed the issue
Thanks for the help. Is there an easy way to modify the html code for liveimu, so that all the read values are stored on the page? The current setup only has a couple of seconds worth of data available
Yes, there are any number of ways more data can be saved. There a sample for saving data to MySQL but the localserver is just a simple node.js server so pretty much anything is possible:
Buffering samples in memory
Storing samples in a fast memory-based database (Redis)
Storing samples in a relational database (MySQL, etc.)
Storing samples in an object database (CouchDB, etc.)
Then of course you need to figure out how you’re going get the data out and visualize it. At some point it probably becomes advantageous to ditch the localserver example and just use an actual app framework like ExpressJS.
Hmm. I’ll take a look at the MySQL. Is there no way to just modify the html so I can have all the collected values on way page? I plan on copying and pasting the data on to a text file so i can process with MATLAB