If you have more than one EV3 Brick, then you can actually send messages from one to the other via wireless Bluetooth connection. In order to do this, the EV3 BRICKs have to be synced with each other using Bluetooth. Pairing with an EV3 Brick or even a smartphone is possible with the Settings menu on the EV3 Brick itself, as discussed in Chapter 2. It is also possible to turn on and off the Bluetooth Connection with the appropriately named Bluetooth Connection programming block, which I will discuss in the next section. It comes in three communication modes: Send, Receive, and Compare.
In order to send a message from one EV3 Brick to the other, you need to have three things.
1. Message Title, which is typed in the upper-right corner.
2. The name of the EV3 Brick that will receive the message, typed in the first parameter.
3. EV3 the message itself, which can be typed in or wired from another source. Note that you want to specify the type of values that you are sending, in the form of Text, Numeric, or Logic. Think of this Send mode as a “Write”.
If the Send mode is the “Write” block, then the Receive mode is the “Read”. The Receive block needs to have the message title of Send block typed in the upper-right corner, and the Receive file has to be set up to receive the proper value (Text, Numeric, or Logic) of the Send file. You can see an example in Figure 5-13.
The programs on the top left and right are highlighted, so that they will run at the same time. It actually uses two EV3 Bricks, one named Nabob and the other Bob. Nabob sends a message known as “Button” which is the input of a Brick Button pressed. Bob then receives this message and outputs it to the display. You will notice another program on the bottom of Figure below which is essentially the same, but with a Wait or Wait For Programming Brick in Messaging Update mode.
This mode takes the Receive one step further, as it takes a received message and then compares it to another value. This is set up in the form of an equation with the usual equality and inequality symbols, with outputs of True or False. Compare is especially good if you want to create a Switch case for the next block.
This block is one that you may or not have to use in your program, depending on whether or not you established a Bluetooth connection with the EV3 display screen. As I mentioned in the Messaging section, the EV3 Brick can be paired with other EV3 Brick, but they can also be paired with a smartphone, tablet, or a computer.
Bluetooth Connection has four modes. The first is On, which allows you to switch on the Bluetooth mode on the EV3 Brick. The second is Off, which switches the Bluetooth off. For Initiate, this is for establishing a connection with a very specific Bluetooth device which you can name in the first parameter. The opposite of Initiate would be Close, which will close the connection. See below for examples.
You may have noticed on the EV3 menu how you can program the EV3 Brick to sleep, or automatically shut off if no command is received after a certain amount of time. You can program it from about 2 minutes to 60 minutes, and it will shut off even if the EV3 Brick is plugged into the computer.
Keep Awake allows the EV3 Brick to keep on going, even though your program is nowhere finished running.
If you like, you can output the Keep Awake to the display, and the number will be whatever you set it up with in the Brick’s Main Menu. You can see an example of this in Figure 5-15.
537 total views, 1 views today