You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+23-2
Original file line number
Diff line number
Diff line change
@@ -85,12 +85,14 @@ In our next section of code, we have an updateLight method that either sets all
85
85
86
86
## Step 3: The iOS Software
87
87
88
-
Since we're a mobile shop, it would seem silly not to write our own custom software to control the project. The only UI we'll need for this is a way to select a Bean, an on/off switch, and a way to specify the color:
88
+
Since we're a mobile shop, it would be silly not to write our own custom software to control the project. The only UI we'll need for this is a way to select a Bean, an on/off switch, and a way to specify the color:
We'll also include the LightBlue Bean's [iOS/OS X SDK](https://github.com/PunchThrough/Bean-iOS-OSX-SDK), which makes working with the Bean a little easier. Since we are using Bluetooth characteristics to send our data, we could also simply use CoreBluetooth, though including the SDK gives us the flexibility to also take advantage of the Bean's serial connection in the future if we want to.
93
93
94
+
### The Browser Screen
95
+
94
96
When the browser for available Beans appears, we use the Bean library to scan for available devices:
95
97
96
98
- (void)viewDidLoad {
@@ -141,7 +143,24 @@ And when the connection is made, we finally initiate the segue to show the contr
Most of the control panel code just deals with UI. The interesting methods allow us to send an update, with a little bit of data massaging, to the Bean.
Most of the control panel code just deals with UI. The interesting methods allow us to send an update, with a little bit of data massaging, to the Bean. (ColorSwatchView is simply a UIView. We use the background color to store and display the current color selected.)
@@ -198,6 +217,8 @@ We also read the data from the bean when we display the screen to set the status
198
217
self.blueSlider.value = blue;
199
218
}
200
219
220
+
With all this code in place, we can finally send updates to our completed light system!
201
221
202
222
## Step 4: Profit?
203
223
224
+
This may not be a practical lighting system for everyone, but for folks with an inclination toward tinkering, it opens up lots of interesting possibilities for customization and improvement. It would be easy to add a variety of animation effects when changing the light's color. One could monitor the Bean's accelerometers so that you can turn the light on and off by thumping the shelf it's mounted under with your fist (I call this ["Fonzie mode"](http://www.dailymotion.com/video/xu7jyb_1st-time-we-see-fonz-hit-the-jukebox-and-stop-and-start-it-upon-command_shortfilms)). The lighting could be automatically adjusted to be more blue in the morning to help you wake up, and more red in the evening so as not to interfere with your sleep, a la [Flux](https://justgetflux.com). And of course one could tie it into various web services to provide quick information on weather, the stock market, etc.
0 commit comments