From 38ea94883b5394eebb4d33af4ae9457fb9e56c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Blanchon?= Date: Sat, 16 Apr 2016 16:20:05 +0200 Subject: [PATCH] Updated Bag of Tricks (markdown) --- Bag-of-Tricks.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Bag-of-Tricks.md b/Bag-of-Tricks.md index 3d18b63..4d53ff1 100644 --- a/Bag-of-Tricks.md +++ b/Bag-of-Tricks.md @@ -14,12 +14,7 @@ And we want to get a `int[]` out of it: #define MAX_LED_COUNT 10 int leds[MAX_LED_COUNT]; -int ledCount = 0; - -for(int led : root["leds"].asArray()) { - leds[ledCount++] = led; - if (ledCount >= MAX_LED_COUNT) break; -} +int ledCount = root["leds"].asArray().copyTo(leds); ``` See issue [#246](https://github.com/bblanchon/ArduinoJson/issues/246)