mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Return JsonArray and JsonObject by value (closes #309)
				
					
				
			This commit is contained in:
		| @@ -48,10 +48,10 @@ void loop() { | ||||
|   StaticJsonDocument<500> doc; | ||||
|  | ||||
|   // Make our document represent an object | ||||
|   JsonObject& root = doc.to<JsonObject>(); | ||||
|   JsonObject root = doc.to<JsonObject>(); | ||||
|  | ||||
|   // Create the "analog" array | ||||
|   JsonArray& analogValues = root.createNestedArray("analog"); | ||||
|   JsonArray analogValues = root.createNestedArray("analog"); | ||||
|   for (int pin = 0; pin < 6; pin++) { | ||||
|     // Read the analog input | ||||
|     int value = analogRead(pin); | ||||
| @@ -61,7 +61,7 @@ void loop() { | ||||
|   } | ||||
|  | ||||
|   // Create the "digital" array | ||||
|   JsonArray& digitalValues = root.createNestedArray("digital"); | ||||
|   JsonArray digitalValues = root.createNestedArray("digital"); | ||||
|   for (int pin = 0; pin < 14; pin++) { | ||||
|     // Read the digital input | ||||
|     int value = digitalRead(pin); | ||||
| @@ -87,15 +87,4 @@ void loop() { | ||||
|   delay(10000); | ||||
| } | ||||
|  | ||||
| // See also | ||||
| // -------- | ||||
| // | ||||
| // The website arduinojson.org contains the documentation for all the functions | ||||
| // used above. It also includes an FAQ that will help you solve any | ||||
| // serialization problem. | ||||
| // Please check it out at: https://arduinojson.org/ | ||||
| // | ||||
| // The book "Mastering ArduinoJson" contains a tutorial on serialization. | ||||
| // It begins with a simple example, then adds more features like serializing | ||||
| // directly to a file or any stream. | ||||
| // Please check it out at: https://arduinojson.org/book/ | ||||
| // Visit https://arduinojson.org/v6/example/udp-beacon/ for more. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user