xerbot 0.1.0 : le contrat xerbot v1 pour Arduino / PlatformIO (USB, ESP-NOW, Bluetooth), 6 exemples dont RuView CSI, test natif 8/8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R75H65SynGwRG5vBSoYeZ1
This commit is contained in:
8
examples/06-uno-minimal/06-uno-minimal.ino
Normal file
8
examples/06-uno-minimal/06-uno-minimal.ino
Normal file
@@ -0,0 +1,8 @@
|
||||
// 06 · le plus petit : un Arduino Uno / Nano (AVR, 2 Ko de RAM). USB seulement ; une ligne de 128 caractères max.
|
||||
#include <Xerbot.h>
|
||||
Xerbot xb("uno", "capteur");
|
||||
void commande(Xerbot& x, const XerbotCommande& c) {
|
||||
if (strcmp(c.cmd, "led") == 0) { digitalWrite(13, c.booleen("on") ? HIGH : LOW); x.ack(c.id, true); } else x.ack(c.id, false);
|
||||
}
|
||||
void setup() { Serial.begin(115200); pinMode(13, OUTPUT); xb.battement(30000); xb.begin(Serial); xb.onCommande(commande); }
|
||||
void loop() { xb.loop(); static unsigned long t = 0; if (millis() - t > 3000) { t = millis(); xb.telemetrie().add("a0", (long)analogRead(A0)).envoyer(); } }
|
||||
Reference in New Issue
Block a user