You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check out https://fmgrafikdesign.gitbook.io/simplewebserial/ for a project overview and installation guide.
2
+
3
+
# SimpleWebSerial
4
+
5
+
SimpleWebSerial helps you to connect a web application with your Arduino, in
6
+
seconds. Get started now by taking a look at the [documentation](https://fmgrafikdesign.gitbook.io/simplewebserial/)! This is the Arduino library of the project. You can find the JavaScript part [here](https://github.com/fmgrafikdesign/SimpleWebSerialJS).
7
+
8
+
## What is this library?
9
+
10
+
This library allows you to connect your website in the browser with an Arduino microcontroller. This effectively means the real world can influence your web application, and vice versa. The library consists of two parts, the [JavaScript part](https://github.com/fmgrafikdesign/SimpleWebSerialJS) which runs in the browser, and the [Arduino part](https://github.com/fmgrafikdesign/simplewebserial-arduino-library) which is installed on your Arduino device. Together, they allow you to write simple, event-driven code both in JavaScript and on the Arduino, enabling two-way communication.
11
+
12
+
Under the hood, it uses the [Web Serial API](https://wicg.github.io/serial/). It handles repetitive setup steps and offers an event-driven style of listening to and sending data. The goal is to allow as many people as possible to explore the possibilities of connecting physical devices to web applications.
13
+
14
+
## Code Style Summary
15
+
16
+
This library employs an event-driven code style. You can register event listeners with callback functions, and send events to the other device. Here's a brief idea how working with the library looks like in the browser and on the Arduino:
// Send named events to browser with a number, string, array or json object
51
+
WebSerial.send("event-from-arduino", 123);
52
+
}
53
+
54
+
voideventCallback(JSONVar data) {
55
+
// Do something, even sending events right back!
56
+
WebSerial.send("event-from-arduino", data);
57
+
});
58
+
59
+
void loop() {
60
+
// Check for new serial data every loop
61
+
WebSerial.check();
62
+
delay(5);
63
+
}
64
+
```
65
+
66
+
## Why this library?
67
+
68
+
The new [Web Serial API](https://wicg.github.io/serial/) is a great way to connect serial devices like the Arduino directly to your web application. It lets your website communicate with the real world, and opens up a lot of possibilities for web developers! However, working with it is cumbersome and very technical. You're left to deal with things like byte-arrays and parsing data. This library makes connecting your web application with an Arduino a breeze, and lets you get up and running in minutes.
69
+
70
+
## Who is this for?
71
+
72
+
This library is for creative minds and developers who like to experiment and create prototypes, but do not necessarily care how something works on the technical level.
73
+
74
+
Do you know your way around web development? Basic concepts like HTML, JavaScript? Then you can use this without problems.
75
+
76
+
Do you like experimenting with new web technologies, maybe learn a new thing or two? This library will give you an idea what's possible when we integrate websites with the real world.
77
+
78
+
## Getting Started
79
+
80
+
Get started by installing the JavaScript library and the Arduino library. You can find a quick setup in the [documentation](https://fmgrafikdesign.gitbook.io/simplewebserial/).
81
+
82
+
Alternatively you can check out the JavaScript repository and have a look at the examples folder. Be aware, you will need an Arduino for all of them, and some parts (LEDs, potentiometer etc) for most of them.
sentence=A library to simplify connecting Arduino to your web applications, using the Web Serial API.
6
6
paragraph=This library is aimed at web developers interested in connecting their web applications to the physical world, with an Arduino. Listen to and send events in JavaScript fashion, without worrying about parsing incoming serial data.
0 commit comments