Commit 7bf5f42f989fd8f76ae72842b68ed330f31212d6

Authored by Moritz Wirger
Committed by GitHub
1 parent 29f5474d

Fix some typos & add part about getting all lights

Showing 1 changed file with 10 additions and 4 deletions
README.md
... ... @@ -29,26 +29,32 @@ where index is your preferred Bridge from the part [Finding Bridges](#findingBri
29 29 ```C++
30 30 Hue bridge = finder.GetBridge(bridges[0]);
31 31 ```
32   -If you on the other hand already have a username you can add you bridge like so
  32 +If you on the other hand already have a username you can add your bridge like so
33 33 ```C++
34 34 finder.AddUsername(bridges[0].mac, "<username>");
35 35 Hue bridge = finder.GetBridge(bridges[0]);
36 36 ```
37 37  
38 38 ### Controlling lights
39   -If you have your Bridge all set up now you can control its lights.
40   -For that create a new HueLight and call getLight(\<id\>) from you bridge object to get a reference to a specific light, where id
  39 +If you have your Bridge all set up, you can now control its lights.
  40 +For that create a new HueLight object and call getLight(\<id\>) on your bridge object to get a reference to a specific light, where id
41 41 is the id of the light set internally by the Hue Bridge.
42 42 ```C++
43 43 HueLight light1 = bridge.getLight(1);
44 44 ```
45   -If you now want to control the light you just call the specific function of the light.
  45 +If you don't know the id of a specific light or want to get an overview over all lights that are controlled by your bridge you can do that by calling getAllLights() on your bridge object. If no lights are founb the vector will be empty.
  46 +```C++
  47 +std::vector<std::reference_wrapper<HueLight>> lights = bridge.getAllLights();
  48 +```
  49 +If you now want to control a light, call a specific function of the it.
46 50 ```C++
47 51 light1.On();
48 52 light1.setBrightness(120);
49 53 light1.alertHueSaturation(25500, 255);
50 54 light1.setColorLoop(true);
51 55 light1.setColorRGB(255, 128, 0);
  56 +lights[1].Off();
  57 +lights.at(1).setColorHue(4562);
52 58 ```
53 59 But keep in mind that some light types do not have all functions available. So you might call a
54 60 specific function, but nothing will happen. For that you might want to check beforehand what type
... ...