NEWS$show=/search/label/news

Here's where you'll find all the latest news about technology for children. We love to follow cool new inventions on Kickstarter and we hunt out all the latest announcements about tech toys and gadgets for the coming Christmas holidays. You'll also get our take on children's technology stories in the media.

REVIEWS$show=/search/label/review

Our kids technology product reviews are intended to help you work out whether a toy, gadget or kit is a good fit for your child or family. There's lots of cool stuff available, but is it the right choice for the child or teenager that you are buying for? We'll help you make the right choices and get the best value for money.

GIFT GUIDES$show=/search/label/gift%20guide

Parents, grandparents, aunts, uncles, and friends assemble. We create gift lists to help you make good choices for kids technology which helps them develop the right skills for the future. We research the best in Coding Toys and Games, Making / Craft Tools and Kits, STEM/STEAM related gifts, Programmable Robots, Electronics Kits and Gadgets for Tech Age Kids and Teens.

PROJECTS$show=/search/label/project

Get crafty with technology. Here we'll post all our ideas and projects using technology to get creative and making with kids. You'll find anything from making a lemon battery to a glow-in-the-dark Minecraft sword. Our projects are tried and tested on our own kids or at events we run, so we are sure you can have a go at home with your kids. Some of our projects use specific tech gadgets which we provide links for you to purchase.

SAM Labs and Minecraft - Summon a Pig at the Push of a Button


With SAM Labs wireless electronics and a bit of Minecraft know-how you too will be able to summon a pig at the push of a physical button. Yes, really. It's all done in vanilla Minecraft too - no mods needed.

The SAM Labs software now has 'apps' for generating virtual keypresses and mouse events. So of course our first thought was to control Minecraft using SAM Labs wireless components. You can find out how we achieved the basics in our Control Minecraft with SAM Labs electronics post.

Check out our SAM Labs review first if you're not familiar with them.

It's fun to be able to mine, place blocks and look around using SAM Labs. But what we really wanted to be able to do was summon a pig at the push of a button. Well not really, but it's a fun project which demonstrates the basic approach we've used and can be built on.

Here's the project in action:


You'll Need:


You just need a SAM Labs button (and Bluetooth dongle) for this particular project.

Minecraft fans are likely to want to combine this project with controlling other Minecraft features with other SAM modules. We like the Make Kit which also has other inputs that we have used for controlling Minecraft.

You'll also need a Minecraft desktop license and Minecraft installed.

Solution Outline

But Minecraft doesn't allow you to detect key presses

You can do lots of clever things with Minecraft Command Blocks but unfortunately detecting key presses isn't yet one of them. Ideally we wanted a solution in vanilla Minecraft (without mods) so we looked at what we can do. 

You can tell which hotbar slot the player has currently selected. We used this to detect when the player selects slot 3 followed by slot 4. Just detecting slot 3 would mean that our block would keep triggering repeatedly. 

Okay, now we can detect when the player selects slot 3 and then slot 4. We can use this trigger a pig summoning command block. 

But SAM Labs doesn't general virtual number presses

SAM Labs doesn't currently support generating virtual presses of the number keys. That's easy to work around though. You can remap your hotbar keys in Minecraft so that letters instead of numbers are used. We used the bottom row of letters plus the L key for slot 8. 

We need to generate two key presses

We want one button press to summon a pig, this involves two key presses, v then b. 

With the SAM labs software it was easy to trigger two key presses. We added a one second delay before the b to make sure that we got v and then b.


Step by Step 

Set up Minecraft:

  1. Create a new Minecraft profile called SAM Labs. You're going to change the keyboard controls so you probably don't want to do that on your main profile.
  2. Create a new Creative Mode world called SAM Labs Pigs. You probably want to set it to Peaceful initially to avoid distractions. 
  3. Find or create a nice flat area in your world. 
  4. Give yourself command blocks with:
    /give @p minecraft:command_block
  5. Create the following layout of command blocks and redstone comparators:


    Configure the command blocks as follows:
    Command Block 1: Repeating; Unconditional; Always Active
    Command Block 2: Repeating; Unconditional; Needs Redstone
    Command Block 3: Impulse; Unconditional; Needs Redstone
  6. Set the commands for the command blocks as follows:

    Command Block 1:
    testfor @a {SelectedItemSlot: 3}
    Command Block 2: 
    testfor @a {SelectedItemSlot: 4}
    Command Block 3:
    summon Pig ~ ~1 ~

    Note that when using commands the slots are numbered from 0 whereas when setting up keys they are numbered from 1!
  7. Test your command blocks by pressing 3 and then 4.
  8. Did you get a pig? Great. 
  9. Now save your world.  Go to Options then Controls and set the hotbar control keys as follows:
    z = slot 1 (0)
    ..
    v = slot 4 (3)
    b = slot 5 (4)
    ...
    l = slot 9 (8)

Set up SAM Labs

You'll need a SAM button and bluetooth dongle and the SAM labs software. 

You'll need to create this project:
  1. Create a new SAM Labs project and call it Minecraft Pigs
  2. Turn on your SAM button and drag it on to the workspace. 
  3. Add a 'To Key' app, set it to 'V' and wire the SAM button to it. 
  4. Add a second 'To Key' app and set it to 'B'. The time add a 'Delay' app from Time and place it in-between the button and the B 'To Key', configure the delay to one second. 

Test it

Now switch back to Minecraft and go into your world. 

Press the button and you should get a pig.

This is what happened when my 7 year old got hold of the button:


Obviously this is just an example of what you can do with SAM Labs and Minecraft. Try summoning other mobs or maybe a LightningBolt!

When my 9 year old got hold of the button, he changed the summon command to summon wolves instead:


Name

2013,13,3d printing,5,3DTin,2,accessories,1,activities,1,adafruit,1,adventure games,1,amazon,12,amazon fire,2,amazon prime,1,android,6,angry birds,1,animation,6,anki,1,app,18,app toy,4,app toys,8,appcessories,1,apple,1,apps,25,arcbotics,1,architecture,4,arckit,9,arduino,33,art,1,artificial intelligence,5,astronauts,2,astronomy,1,augmented reality,11,automaton,1,awards,1,battle bots,2,battling robots,2,bedtime,1,big kids,99,big tablets,1,bigtrak,1,bike,1,binary,1,birthday,4,bitsbox,1,black friday,2,blockly,1,blogging,1,bloxels,1,bluetooth,2,board games,7,books,34,boolean box,1,breadboard,2,bricks,1,brixo,1,buying guide,5,camera,4,cameras,1,card game,1,careers,2,catroid,1,celebration,1,cellphone,1,ces,2,chemistry,2,chess,1,christmas,42,circuit cubes,1,circuit playground,8,circuit scribe,10,cleaning,1,climbing,1,code clubs,1,code-a-pillar,1,codebug,1,coder,2,coding,169,cognitive learning,1,communication,1,comparison,1,competition/challenges,9,computational thinking,3,computer,2,computer games,1,computer science,2,computer vision,2,computers,1,computing,1,conductive playdough,2,connected toys,7,construction,40,conversational ai,1,cozmo,1,craft,34,craft cutter,3,creative thinking,1,creativity,3,crochet,1,crowdfunding,119,css,1,cubs,1,curiosity,1,curious chip,1,cyber monday,1,dads,1,data,1,deals,4,dens,2,design,10,design process,1,design thinking,7,digital parenting,2,digital skills,13,disability,1,disney infinity,1,dog tech,1,dolls,2,drawing,2,drones,2,duinokit,1,earth day,1,Easter,4,ebooks,11,eco,1,edblocks,1,edison,5,edtech,1,education,79,egypt,1,electricity,1,electronic pets,2,electronic toys,2,electronics,141,electronics kit,3,electronics kits,1,electtronics,1,elementary,1,elenco,2,energy,1,engineering,17,entertainment,1,ereader,1,ereaders,6,esafety,1,escape the room,1,event,21,ewriter,1,exercise,4,family,12,family tech,2,fathers day,1,Festival of Code,1,fiction,1,fitness tracker,2,flotilla,3,flow charts,1,flutterbye fairy,1,flying,1,force awakens,2,force friday,2,future,2,gadgets,36,games,35,games console,2,games consoles,8,gaming,3,gift guide,53,gifts,12,girls,23,giveaway,4,glow in the dark,1,google,1,grace hopper,1,grove,1,hackaball,2,hacksoton,1,halloween,12,halloween costumes,1,hardware,2,headphones,1,health,1,hexbug,3,hexbug aquabots,1,hexbug project,1,high school,1,history,26,home,1,home education,2,homeschool,4,hot toys,7,hour of code,3,html,4,humanoid,4,ICT,1,in app purchasing,1,indiegogo,13,industry event,9,innotab,5,innotab 3,3,innotab 3s,1,internet access,1,interviews,1,invention,4,ios,3,IoT,4,ipad,7,ipad mini,1,iphone,2,jacquard,1,japan,1,java,1,javascript,5,k'nex,7,k'nex robotics,1,kano,7,keyboard,1,kickstarter,91,kids,3,kindle,5,kindle fire,8,kit,2,kits,5,kodu,1,kubo,1,label printer,1,languages,1,laptop,1,laptops,1,last minute,1,leap motion,1,leapfrog,2,leappad,7,leappad 2,3,leappad ultra,3,leappad2,1,leapreader,1,learning,5,learning resources,5,learning tablet,2,learning tablets,9,leds,2,lego,36,lego boost,1,lego chain reactions,1,lego mindstorms ev3,5,lego power functions,2,lego technic,5,lego wedo,2,let's start coding,1,lights,1,lightseekers,1,little kids,110,littlebits,16,logiblocs,1,logic,3,logical thinking,4,loom,1,machines,1,magnetic,1,make it,2,makeblock,16,makedo,1,maker,6,makey makey,6,making,54,mardles,1,mars,1,mars rover,1,marty,1,math,3,maths,1,mbot,6,mbot ranger,1,me arm,1,meccano,6,meccanoid,5,meccanoid 2.0,1,merge vr,1,mews,1,michael faraday,1,micro:bit,9,microbit,6,microcontroller,5,microscope,1,microsoft,1,middle school,6,miles kelly,1,mindstorms,3,minecraft,21,minecraft mods,1,mixed reality,1,mobile,1,modular electronics,2,monsters university,1,morse code,2,mothers day,4,motion capture,1,motors,2,mover kit,3,movie,1,movies,4,mu,1,mu toys,1,munzee,1,music,10,my first robot,2,national dog day,1,nature,1,new year,1,news,167,news coding,1,nikola tesla,1,nintendo,2,nintendo switch,2,ohbot,3,ollie,3,on the web,1,opinion,19,origami,1,osmo,4,outdoors,13,ouya,1,ozobot,10,papercraft,3,parental controls,2,parenting,34,parrot,1,pc,1,people,8,pet tech,2,pets,3,phone,1,photography,1,photon,1,physics,3,pi day,1,picks,2,pimoroni,1,pinoccio,1,pixel kit,1,pixelart,4,play,2,playstation 4,3,plezmo,1,pocket code,1,pocket money,1,pokemon,4,pokemon go,4,poll,1,pre order,1,pre-teens,1,prehistory,1,preschoolers,41,primary,41,printable,1,products,34,professor einstein,1,programming,15,project,102,projects,11,puzzles,4,python,10,racing,1,raspberry pi,29,reading,12,reivew,1,remote control,1,research,3,resource,34,resources,2,retro,2,review,219,rights,1,robot,10,robot dog,1,robot fish,1,robot wars,3,ROBOTERRA,1,roboticals,1,robotics,32,robots,140,role models,1,role play,1,romo,1,romotive,1,root,1,rover,1,safety,2,sam labs,6,samuel morse,1,sandbox,1,schools,3,science,16,scratch,44,scratchjr,2,screen time,2,screenless,15,screens,1,sensors,5,servos,1,simbrix,7,skills,1,skylanders,3,skylanders superchargers,1,skylanders swap force,1,smart pens,1,smartphone,1,smartwatch,1,snap circuits,2,social media,1,solar power,2,soldering,2,sonic pi,1,sony koov,1,sound,3,space,8,sparki,2,speaker,3,speech sythesis,1,sphero,12,sphero mini,1,spider,2,star wars,6,stars,1,STEAM,1,stem,10,stikbot,1,stop motion,2,stop motion studio,1,storage,1,story,2,strawbees,2,students,1,subscription,5,subscriptions,1,sugru,1,summer,7,swift,1,tablet,2,tablets,23,tangible coding,2,tech,3,tech age,1,tech craft,4,tech is bad,7,tech is good,4,tech toys,21,tech will save us,10,technology,2,technology will save us,3,teens,61,teknikio,3,tekno,1,teksta,1,tenka labs,1,tesla,1,textiles,1,thames & kosmos,2,the extraordinaires,1,tim berners lee,1,tinkercad,1,tinybop,3,toddlers,8,toot-toot,1,top pick,4,touch,1,toy,1,toys,5,travelling,1,TV,1,tween,1,tweens,118,tynker,2,typing,1,ux,1,vehicles,1,videos,3,view-master,1,views,10,virtual reality,8,voice assistants,1,voice recognition,2,vtech,8,web,2,websites,1,wifi,1,wii,2,wii u,2,windows 8,1,wonder workshop,9,wowwee,2,writing,7,writing. education,1,xbox one,2,xyzprinting,1,
ltr
item
Tech Age Kids | Technology for Children: SAM Labs and Minecraft - Summon a Pig at the Push of a Button
SAM Labs and Minecraft - Summon a Pig at the Push of a Button
https://3.bp.blogspot.com/-5LEJ7szWnIk/Vx8-eWU3UJI/AAAAAAAABjE/IImzEj9TSdAwdpEA9NAXZZ1fvffK1sehQCLcB/s640/SAM-LABS-PIGS-HEAD.png
https://3.bp.blogspot.com/-5LEJ7szWnIk/Vx8-eWU3UJI/AAAAAAAABjE/IImzEj9TSdAwdpEA9NAXZZ1fvffK1sehQCLcB/s72-c/SAM-LABS-PIGS-HEAD.png
Tech Age Kids | Technology for Children
https://www.techagekids.com/2016/04/sam-labs-and-minecraft-summon-pig-at.html
https://www.techagekids.com/
https://www.techagekids.com/
https://www.techagekids.com/2016/04/sam-labs-and-minecraft-summon-pig-at.html
true
15639169850959392
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy