Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample Code to control LED/Motor using Web Serial #1

Open
beniroquai opened this issue Jan 18, 2023 · 3 comments
Open

Sample Code to control LED/Motor using Web Serial #1

beniroquai opened this issue Jan 18, 2023 · 3 comments

Comments

@beniroquai
Copy link

beniroquai commented Jan 18, 2023

It would be nice have a simple installation-free online tool that connects to the ESP board and sends some commands to test LED/Motors, etc.

The sample code can be found here.

It gets rendered here: https://youseetoo.github.io/indexWebSerialTest.html

It uses the following JS library: https://github.com/makeabilitylab/p5js/

So far: It's connecting, but I guess something with line-break or Baudrate is not setup properly.

@renerichter, would you mind helping here? :)

@beniroquai
Copy link
Author

@renerichter? ;-)

@beniroquai
Copy link
Author

Hey @frauzufall, as discussed earlier today: I'll just link you here.
This repository is the current firmware for the UC2 microscopes. We have the "flashing" website => youseetoo.github.io
which makes use of the webserial protocol. I have started creating a super simple example page as mentioned earlier:

It would be nice have a simple installation-free online tool that connects to the ESP board and sends some commands to test LED/Motors, etc.

The sample code can be found here.

It gets rendered here: https://youseetoo.github.io/indexWebSerialTest.html

It uses the following JS library: https://github.com/makeabilitylab/p5js/

So far: It's connecting, but I guess something with line-break or Baudrate is not setup properly.

I think people in general are overwhelmed to install 100 python dependencies. So using the browser instead would be wonderful. (almost installation free) + we can use the webcam interface to readout the videos :-)

A long-term dream would be a platform that entirely runs in the browser, but perhaps we could start with small steps and just turn on/off an LED.

The general structure of the commands is somewhat documented here:
https://github.com/youseetoo/uc2-esp32/blob/mergeBD/main/json_api_BD.txt#L102 (e.g. for sending an "act" command to the ledarray). The whole concept is inspired by the REST API.
If you have a spare ESP32 microcontroller, you could try flashing the firmware and try the javascript code to see what happens. :-)

The python library is currently hosted here: https://github.com/openUC2/UC2-REST/tree/master/uc2rest

Would be great if you can have a quick look. My guessing: A Baudrate/line ending problem in the serial connection or something like that.

@beniroquai
Copy link
Author

@renerichter perhaps you are keen on optimizing/beautifying the sample page? ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant