mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Improved the example
This commit is contained in:
		| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * Arduino JSON library |  * Arduino JSON library - Generator example | ||||||
|  * Benoit Blanchon 2014 - MIT License |  * Benoit Blanchon 2014 - MIT License | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @@ -11,22 +11,20 @@ void setup() | |||||||
| { | { | ||||||
|     Serial.begin(9600); |     Serial.begin(9600); | ||||||
|  |  | ||||||
|     JsonHashTable<3> h;     |     JsonHashTable<3> json; | ||||||
|  |  | ||||||
|     h.add("pi", 3.14159265358979323846, 4); |     json.add("sensor", "gps"); | ||||||
|  |     json.add("time", 1351824120); | ||||||
|  |  | ||||||
|     JsonArray<3> a; |     JsonArray<3> array; | ||||||
|     a.add(1); |     array.add(48.756080, 6); | ||||||
|     a.add(2); |     array.add(2.302038, 6); | ||||||
|     a.add(3); |     json.add("data", array); | ||||||
|     h.add("list", a); |  | ||||||
|  |  | ||||||
|     h.add("hello", "world"); |     Serial.print(json); // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} | ||||||
|  |  | ||||||
|     Serial.print(h); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void loop() | void loop() | ||||||
| { | { | ||||||
|  |  | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user