{"id":14012,"date":"2020-07-16T16:29:02","date_gmt":"2020-07-16T06:29:02","guid":{"rendered":"http:\/\/legoeng.local\/?p=14012"},"modified":"2020-12-06T20:50:00","modified_gmt":"2020-12-06T09:50:00","slug":"the-heart-of-the-hub","status":"publish","type":"post","link":"http:\/\/legoeng.local\/the-heart-of-the-hub\/","title":{"rendered":"The Heart of the Hub"},"content":{"rendered":"
\"\"<\/a>
The SPIKE Prime Hub<\/figcaption><\/figure>\n

When you power up the SPIKE Prime hub, the first thing you see on the display is a pixelated heart. It might look a little cute and quirky, but it\u2019s quite likely that you don\u2019t think much more of it and just get on with programming or scrolling through your stored programs.<\/p>\n

Maybe you have pushed the centre button and seen a few blinking dots that don\u2019t really mean much to you, but there\u2019s a lot more to it than that. This “heart program” is a powerful testing tool that allows you to make things work without even programming them.<\/p>\n

The first thing this nifty program does is show you what is connected to the Hub. If you run it with nothing connected, it will display a single dot next to each sensor\/motor port. When you plug in sensors or motors you will see the display change accordingly, but that’s just the beginning.<\/p>\n

\"\"<\/a>
Running the heart program with no sensors or motors connected<\/figcaption><\/figure>\n

Working with sensors<\/h2>\n

If you connect a sensor, the display shows a little bar graph between the two ports on that row, based on the sensor reading.\u00a0When sensors are plugged in (up to a maximum of one per port row), the bars on the display change according to sensor readings. At the very least this lets you know that your sensors are actually working. It can also be used to determine whether the sensor is reading high or low based on a certain condition.<\/p>\n

\"\"<\/a>
Connect a sensor while running the heart program to get some simple sensor feedback<\/figcaption><\/figure>\n

Working with motors<\/h2>\n

It gets even better. You can test your builds without any programming or even build simple things that work without code.\u00a0If you connect a motor, the six dots disappear and are replaced with two, one at the motor port and the other moving continuously from the opposite port to the connected port.<\/p>\n

\"\"<\/a>
Control a motor using the heart program<\/figcaption><\/figure>\n

Pressing an arrow button will turn on any connected motors. The more times you press the button, the faster the motors will go. The other arrow button will slow down the motors with each press. Once the motors have stopped, either button will make the motors move again. The direction in which the motors turn depends on which button is pressed and the side of the hub that the motor is connected to.<\/p>\n

This feature is obviously very useful when you just need to make some motors go round \u2013 maybe testing things at different speeds or seeing if your attachments work before programming them. Just be careful \u2013 because when you press either arrow button, ALL the motors will turn.<\/p>\n

\"\"<\/a>
Multiple motors can be controlled simultaneously<\/figcaption><\/figure>\n

Control a motor with a sensor<\/h2>\n

The heart program has one more trick up its sleeve. If you connect a sensor to a port opposite a motor, the motor will turn at a speed based on the reading of the sensor. A solid bar of pixels connects the two ports, pulsing as the sensor reading changes. You can make simple sensor-based devices without any programming at all!<\/p>\n

\"\"<\/a>
Use a sensor to control a motor by connecting them to opposite ports<\/figcaption><\/figure>\n

A motor can be made to turn faster the closer the ultrasonic sensor reads, or the harder the force sensor is pressed. It\u2019s that easy, and it can be a big help if your code isn\u2019t working right \u2013 you can check that your build works independently of the programming and narrow down the problem.<\/p>\n

The next time you use the SPIKE Prime kit, have a look at the program at “the heart” of the hub. It\u2019s an interesting and powerful tool to help you build faster!<\/p>\n","protected":false},"excerpt":{"rendered":"

When you power up the SPIKE Prime hub, the first thing you see on the display is a pixelated heart. It might look a little cute and quirky, but it\u2019s quite likely that you don\u2019t think much more of it and just get on with programming or scrolling through your stored programs. Maybe you have […]<\/p>\n","protected":false},"author":769,"featured_media":14027,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,159],"tags":[],"_links":{"self":[{"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/posts\/14012"}],"collection":[{"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/users\/769"}],"replies":[{"embeddable":true,"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/comments?post=14012"}],"version-history":[{"count":0,"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/posts\/14012\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/media\/14027"}],"wp:attachment":[{"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/media?parent=14012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/categories?post=14012"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/legoeng.local\/wp-json\/wp\/v2\/tags?post=14012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}