Sunday, November 22, 2015

Minecraft: The Castle that commands and command blocks built

My middle son was playing Minecraft and wanted a command block. He didn't really know what they were or what they did but he wanted one. I did a little research and found you have to use a command to get a command block.


This gives the player listed the number of command blocks specified. If no number was specified it defaults to one.

If you wanted 47 diamonds you would do something like:

/give YOUR_PLAYER_NAME_HERE diamond 47

Once you have mastered that you can move on to the next phase.

Targeting the nearest player. Instead of targeting a specific player you can target the nearest with @p

/give @p command_block

That gives the nearest player a command block. Pretty handy.

If you place a command_block and put a button on it you execute the command with the press of the button.

I have made a command_button giver:

And the command:
*Note Previous Output user name removed.

So this is moderately interesting. You could use a dispenser for this but you would have to keep filling it up. This is a close enough to infinite item spawner.

You can also fill an area with an item. If you fill it with air you can clear a flat space to build a base. This is useful if you want a flat area to build on, but like the surrounding terrain, versus the super flat world.

Fill works thusly:


Why did I put X Y Z twice? It is a range. This range can be a single block if the numbers are the same or a column, or row, or a cube.

To build my castle I cleared a bit of terrain. To find the X Y Z press "F3" on your keyboard. It shows the position of you in XYZ, and the block in Block.

To hide the debug window press "F3" again. Through a bit of trial and error you will soon be an expert in three dimensional coordinates.

This page has a pretty comprehensive list of items:

An important item to remember is "air" that lets you clear a space. I cleared a big cube to start. Then I added walls. The only bit that wasn't added was the crenellations.

Using this fill command you can make gates open and close as well as drawbridges.

You can connect the blocks together for multiple effects using redstone wire. If you want a delay use a redstone repeater. 

Here is my close gate and remove the draw bridge.

You can even make a convertible castle:

Okay that was fun but what about making some monsters?


Wednesday, November 18, 2015

Using an ultrasonic sensor with a Rasberry Pi

I was helping a friend build a robot the other day and he was having difficulty with the ultra sonic sensor. I offered to test it on my Pi which a "B" model. I followed this guide:
and hooked it up using the single 1k resistor. I used a total of 5 DuPont connector wires and put the resistor between two.

I had to alter the timeout of the code to a full 1 second to get valid results. Also I had to adjust the GPIO pins used to the ones that I actually used to hook up.

It worked out nicely: