File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ // Bridge.begin(); <- statica nel loader di zephyr / core
2+ // -> rpc.call("$/reset", res);
3+
4+ void setup () {
5+ pinMode (LED_BUILTIN, OUTPUT);
6+
7+ if (!Bridge.provide (" set_led" , set_led)) { // -> rpc.call("$/register", res, "set_led");
8+ // ERRORE!
9+ };
10+ Bridge.provide (" add" , add); // -> rpc.call("$/register", res, "add");
11+ // ERRORE ignorato
12+ Bridge.provide (" greet" , greet); // -> rpc.call("$/register", res, "greet");
13+
14+ // metodi forniti con provide possono ricevere anche notifiche (semplicemente il risultato non viene restituito)
15+ }
16+
17+ bool set_led (bool state) {
18+ digitalWrite (LED_BUILTIN, state);
19+ return state;
20+ }
21+
22+ int add (int a, int b) {
23+ return a + b;
24+ }
25+
26+ String greet () {
27+ return String (" Hello Friend" );
28+ }
29+
30+ void loop () {
31+ float res;
32+ if (!Bridge.call (" multiply" , res, 1.0 , 2.0 )) {
33+ // ERRORE!
34+ };
35+
36+ Bridge.notify (" signal" , 200 );
37+
38+ // update viene chiamato automaticamente in un thread separato
39+ // Bridge.update(); -> server.run();
40+ }
You can’t perform that action at this time.
0 commit comments