https/http server is used for outside world(boards)
snap! image is NOT modified for Snap4Arduino??? right?
How Snap4Arduino is implemented?
a) Which code is used for firmata --> https/http bridge?
b) How [Arduino] category is established in Snap4Arduino IDE?
c) Where is [Arduino] category's block codes?
For other than 8bit processors (Arduino family), also take look at MicroBlocks for physical and real-time computing needs.
MicroBlocks is fully integratable with SNAP and will offer you much more flexibility than working under the Firmata model.
For examples of SNAP interaction with MB, check out: Interacting with Snap! | MicroBlocks Wiki
Enjoy.
We're not using any bridges. This project uses nw.js, which lets us mix Node.js and Webkit. That means we can call OS-level JS from the "browser" side.
@tguneysu@bromagosa Thanks for the reply, I'm sure that I need some time to understand much more.
And at the mean time, I think my intention (to ask much detailed dev info) is that we are tring to control iNav/BetaFlight flight controllers through MSP protocol, which is binary serial(UART) frame format.
And I also think use Snap4Arduino's framework might be take me less time to complete the task. What do you think? If Snap4Arduino can do the work, what steps should I take?
--
The outcome should be something much more like Snap4Arduino:
e.g.
a) Connect/disconnect Arduino ==> Connect/disconnect AutoPilot
b) Set pin to value ==> set throttle/pitch/roll/yaw to value
create the PC application acting as a "Configurator/Ground Station" part of the MSP and already have communication hardware accessible to computer via USB?
or wish to construct a device capable of exchanging MSP packets with FC via any means (WiFi, BLE, ESP-Now, RF, LoRa, UART wired) and PC at the other side via USB?
has a built-in "Serial Ports" library that can be used with USB-CDC or Classic Bluetooth SPP devices.
@dardoro Currently, community has configurators connectting FC with USB-CDC or Bluetooth SPP.
What I'm trying to do is connectting FC via wifi first. Maybe we can call it a device, as data flows
a) FC<-->wifi device (embedded https/http server) <--> SnapLibrary <--> Snap IDE (Snap4Arduino or snapWeb)
b) FC<-->wifi device (TCP/IP server) <--> PC/laptop https/http server <--> SnapLibrary< --> Snap IDE (Snap4Arduino or snapWeb)
So where should i start, any suggestion and ideas?
Note: wifi device might be limited capabilities, just used as a communication channel.
Do You think of a PC connected to a remote wifi device?
To make it more verbose
PC{Snap, std WiFi( client)} <-------- HTTP -------->Drone{WiFi device(AP, https server) FC}
And you want to build a PC application and a WiFi device?
For multi drone scenario more suitable will be
PC{ WiFi SoftAp} <------>Drone{ Wifi device( client)}
Or even extra Wifi device acting as an AP for the whole "family", connected to PC as an USB device.
Some vendors offers a proprietary RF or WiFi extensions to act as a connection-less and/or long range "mesh" or "cloud" (ESP now , NRF).
When a PC and a drone connect to the same WLAN, you can use the standard URL block to send a MSP packet to the drone and receive a response. But you know that already
If FC understand only raw TCP socket, some form of the HTTP/TCP gateway is needed (Python,C).
Or you can bundle as an Electron.js application and use native TCP socket library.
One last question about dev stuff: How to bundle snap & https/http service, is there any script (Hmmm.. something like linux shell scritps.) that combines https/http server and snap, and how to do this?
There are no such scripts, but Snap4Arduino Desktop is one such bundle, and it includes an HTTP server, which is described at https://snap4arduino.rocks/ => HTTP PROTOCOL
Thanks for you time and patience. I'm NOT familiar with js and snap4arduino dev, just basic knowledge about C/C++ in embedded dev. So how snap4arduino is launched or started, something like PX4 boot sequence (initialization).
Currently, I have had a glimp of js programming (node blabla.js, like gcc helloworld.c ==> a.out, run ./a.out).
Is there any simple code framework for snap + https/https(js) , very basic /easy code example simillar to snap4arduino .
Or any guide link for me to add code for snap4arduino, such as (USB CDC, Bluetooth SPP)Arduino Component, we call it (WiFi) MSP Component.
I made proof of concept TCPClient but forgot to publish it.
You should open this link in the desktop version (Open from URL...) with Javascript extension enabled.
This
connects to a given IP, port and emit a broadcast when some data is received.
Thanks for the demo, although I didn't know much about it.
Currently, I have got Restful server work with snap (post/get) json strings. What I wanna do is:
Is it possible for snap to broadcast a group udp message and server will listen and response to this message (I think server code is easy c code, I can manage it)
"Desktop" means the standalone version of Snap4Arduino . It's Node/nw.js application so you can run native modules like "dgram" for UDP.
I've updated the example.
BTW:
"192.168.0.255" is an UDP broadcast adres of the private IP subnet of my home router.