Arduino and LEGO Projects
Language: English
Pages: 212
ISBN: 1430249293
Format: PDF / Kindle (mobi) / ePub
We all know how awesome LEGO is, and more and more people are discovering how many amazing things you can do with Arduino. In Arduino and LEGO Projects, Jon Lazar shows you how to combine two of the coolest things on the planet to make fun gadgets like a Magic Lantern RF reader, a sensor-enabled LEGO music box, and even an Arduino-controlled LEGO train set.
- Learn that SNOT is actually cool (it means Studs Not on Top)
- See detailed explanations and images of how everything fits together
- Learn how Arduino fits into each project, including code and explanations
Whether you want to impress your friends, annoy the cat, or just kick back and bask in the awesomeness of your creations, Arduino and LEGO Projects shows you just what you need and how to put it all together.
of bricks continues the walls and frames the sensors as well. The PING))) Ultrasonic Distance Sensors are two bricks high, so you need add another layer, as shown in Figure 2-23. Figure 2-22.The ultrasonic sensors are placed on the body of the Android Figure 2-23.A second layer is added to frame the ultrasonic sensors Once the walls are built up around the sensors, you lock them in using a layer of bricks on top, as seen in Figure 2-24. If there is too much pressure on the sensors when
hole when you begin building Figure 3-12.The third layer covers the second and locks the lid into place Figure 3-13.The back of the box shows how the Ethernet, USB, and power ports are easily accessible Adding Rings The Twitter Pet is made of concentric rings that rest on top of the box. There are five sets of rings that stack atop each other to build the Twitter Pet’s body. There is a single ring with a larger ring that is two bricks high atop it, followed by the widest ring that is four
do so. // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } Once the setup runs, it then executes whatever is between the braces after loop(). The difference is that once the section in the loop() starts, it will start that
black 1 x 2 plates 24 black 2 x 2 plates 4 black 2 x 4 plates 7 black 4 x 4 plates 1 black 4 x 6 plate 4 black 1 x 1 plates 14 black 1 x 2 plates 2 black 6 x 8 plates 1 black 1 x 3 plate 4 black 1 x 4 plates 6 black 1 x 1 bricks 26 black 1 x 2 bricks 2 black x`1 x 3 bricks 2 black 1 x 4 bricks 2 black 1 x 10 bricks 21 black 2 x 3 bricks 3 black 2 x 2 bricks 32 black 2 x 4 bricks 39 red 1 x 2 bricks 1 red 1 x 8 brick 2 light gray hinge plates 1 x 2 with 2 fingers on end 2
value is returned. In the function microsecondsToInches(), you are doing some fairly simple mathematics, so you are doing the math and returning the value on the same line. You could do more complex processing and set the value to a variable, then have the code read return variable to export the answer from the variable rather than directly from the line of code. In your function, you are dividing the number of microseconds it takes sound to travel an inch and dividing by two, since the duration