Blaminatrs are perfect office toys that you can use in many situations. For
software developers, it can be a good idea to attach one to your continuous
integration (CI) system. Continuous integration systems, such as Jenkins,
3
help you continuously check whether your software is in good shape.
Whenever a developer checks in changes, the CI automatically compiles the
software and runs all tests. Then it publishes the results via email or as an
RSS feed. You can easily write a small piece of software that subscribes to
such a feed. Whenever someone breaks the build, you’ll find a notification in
the feed, and you can use the Blaminatr to point to the name of the developer
who has committed the latest changes.
4
In the previous section, you learned all about the servo motor you need to
build the Blaminatr. Now we need only some creativity to build the device’s
display, and we need more elaborate software. We start with a class named
Team
that represents the members of our team; that is, the potential “blamees”:
Motors/Blaminatr/Blaminatr.ino
const unsigned int MAX_MEMBERS = 10;
Line 1
-
class Team {
-
const char** _members;
-
unsigned int _num_members;
5
unsigned int _positions[MAX_MEMBERS];
-
public:
-
Team(const char** members) {
-
_members = members;
-
_num_members = 0;
10
const char** member = _members;
-
while (*member++)
-
_num_members++;
-
-
const unsigned int share = 180 / _num_members;
15
unsigned int pos = share / 2;
-
for (unsigned int i = 0; i < _num_members; i++) {
-
_positions[i] = pos;
-
pos += share;
-
}
20
}
-
-
int get_position(const char* name) const {
-
int position = 0;
-
for (unsigned int i = 0; i < _num_members; i++) {
25
if (!strcmp(_members[i], name)) {
-
3.
http://jenkins-ci.org//
4. At
http://urbanhonking.com/ideasfordozens/2010/05/19/the_github_stoplight/
, you can see an alternative
project. It uses a traffic light to indicate your project’s current status.
report erratum • discuss
Building a Blaminatr • 231
www.it-ebooks.info