Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Is it possible to communicating with Arduino?

labz
Registered User
Quote
2023-05-21 14:49:42

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?


okeoke
Registered User
Quote
2023-05-21 16:57:36

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.


just_in_case
Moderator
Quote
2023-05-21 16:57:51

Yes, it is possible, but only on windows platform, with the help of command line tools.


okeoke
Registered User
Quote
2023-05-21 17:05:43

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.



labz
Registered User
Quote
2023-05-22 04:55:56

Thanks, I will study the JavaScript next. And I'd like to share the result here.


labz
Registered User
Quote
2023-06-04 14:50:57

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


just_in_case
Moderator
Quote
2023-06-05 08:17:44

@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


labz
Registered User
Quote
2023-06-05 13:49:35

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.


labz
Registered User
Quote
2023-07-22 08:18:35

CubeCopper interactive with FireBeetle(ESP32) Demo1

https://mc.dfrobot.com.cn/thread-316540-1-1.html


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact