Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'd like to make something that can interactive with real world. Is it possible to read and write the serial port? Or it there any interface on PC that I can use? E.g, USB , Bluetooth? Thanks? |
||||
|
Hi labz, You can access serial port from a game build for web. 1. Create a webgl game using coppercube 2. Using node js build an express app to serve your game https://www.npmjs.com/package/express 3. Establish a network connection from express to your client side coppercube game using any tool you want. I would suggest using socket.io https://www.npmjs.com/package/socket.io 4. Use serialport library to communicate with arduino using serial port: https://www.npmjs.com/package/serialport The other way would be to make ipcsystem using read/write file to disk. I.e. your coppercube game writes some commands to the hard drive using ccbWriteFileContent and then there is another application, which controls arduino using serial, just reads and executes the commands from that file. In that second approach you can also use ccbDoHTTPRequest for ipc. I guess, you can also buy a studio version and add some serial port library support - not sure if it will work though, since I don't own it. |
||||
|
Yes, it is possible, but only on windows platform, with the help of command line tools. |
||||
|
Good point - that's also a way if you do not need to get any data from arduino, but just send the input. wrote:
Yes, it is possible, but only on windows platform, with the help of command line tools. |
||||
|
Thanks, I will study the JavaScript next. And I'd like to share the result here. |
||||
|
ESP32 is the best arduino board for CCB. It can run a simple http server on it. And you can get data by ccbDoHTTPRequest in CCB. I made a simple demo with ESP32 , you can see in here https://www.bilibili.com/video/BV19h411F7fJ/?spm_id_from=333.337.search-card.all.click |
||||
|
@labz , Nice video, glad that it worked with the external hardwares, this shows that Coppercube is capable of doing more than people expect. Thanks for making the video ![]() |
||||
|
I would share the code and introduce how to make it later. But as you know, it's much harder to write an article than making things. ![]() |
||||
|
CubeCopper interactive with FireBeetle(ESP32) Demo1 https://mc.dfrobot.com.cn/thread-316540-1-1.html |
|