|
3 | 3 |
|
4 | 4 | == Overview |
5 | 5 |
|
6 | | -A digital output can be thought of as the signal to an LED or a relay. These examples use the GPIO Pins [D16,D17],[D18,D19],[D20,D21] that correspond to connectors D16,D18 and D20 on the grove hat. |
| 6 | +A digital output can be thought of as the signal to an LED or a relay. These examples use the GPIO Pins [D16,D17],[D18,D19],[D20,D21] that correspond to connectors D16,D18 and D20 on the grove shield. |
7 | 7 |
|
8 | 8 | image::GroveDigitalConnectionsPico.png[] |
9 | 9 |
|
10 | 10 | * xref:grove-digital-outputs.adoc[Grove Digital Outputs] |
11 | 11 |
|
| 12 | +== Hardware Details |
| 13 | + |
| 14 | +https://wiki.seeedstudio.com/Grove-Red_LED/[Grove LED] |
| 15 | + |
| 16 | +https://wiki.seeedstudio.com/Grove-Relay/[Grove Relay] |
| 17 | + |
| 18 | + |
| 19 | +== Demo Video |
| 20 | + |
| 21 | +Here is a video that shows the set-up and running of the LED and Relay Examples |
| 22 | + |
| 23 | +video::5MPWDghnn5Q[youtube] |
| 24 | + |
| 25 | +== Example Code |
| 26 | + |
| 27 | +Navigate to >>Scratchpad>>Grove>>Digital Inputs>>Grove Digital Out.vi |
| 28 | + |
| 29 | +image::GroveDigitalOutLEDProject.png[] |
| 30 | + |
| 31 | +This particular VI uses the Green LED. Select the port for the connected Pico and the Grove connector that the board is plugged into. Press the run arrow. |
| 32 | + |
| 33 | +When you press the [Control Button] the LED should toggle on and off. |
| 34 | + |
| 35 | +Links to various other similar boards are also on the Front Panel. |
| 36 | + |
| 37 | +image::GroveDigitalOutLEDFP.png[] |
| 38 | + |
| 39 | +On the block diagram you can see that the selected Grove connector dictates the GPIO Pin and we then set the pin to [Out]. Next we loop round and event structure and use the Control Value Change Event to set the LED. Pressing Stop will fire the Stop event and exit the loop. |
| 40 | +The video shows the same VI being used to switch a relay on and off. |
| 41 | + |
| 42 | +image::GroveDigitalOutLEDBD.png[] |
| 43 | + |
| 44 | += I2C Digital Output Boards |
| 45 | + |
12 | 46 | There are also options that communicate using I2C. These will use connectors I2C0 and I2C1 as shown. |
13 | 47 |
|
14 | 48 | image::GrovePicoShieldI2CConnection.png[] |
15 | | -* xref:grove-i2c-4-channel-spdt-relay-board.adoc[Grove I2C 4 Channel Relay Board] |
| 49 | +* xref:grove-i2c-4-channel-spdt-relay-board.adoc[Grove I2C 4 Channel Relay Board] |
| 50 | + |
| 51 | +This example uses the grove 4 Channel Relay module, there are other similar modules that may work with this code. |
| 52 | + |
| 53 | +The GPIO Pins used are [I2C0] or [I2C1] |
| 54 | + |
| 55 | +image::GrovePicoShieldI2CConnection.png[] |
| 56 | + |
| 57 | + |
| 58 | +== Hardware Details |
| 59 | + |
| 60 | +https://wiki.seeedstudio.com/Grove-4-Channel_SPDT_Relay/[Grove I2C 4 Channel SPDT Relay Board] |
| 61 | + |
| 62 | + |
| 63 | +== Demo Video |
| 64 | + |
| 65 | +Here is a video that shows the set-up and running of the 4 Channel Relay Board |
| 66 | + |
| 67 | +video::0Jp3GYXE-z4[youtube] |
| 68 | + |
| 69 | +== Example Code |
| 70 | + |
| 71 | +Navigate to >>Scratchpad>>Grove>>Switches>>I2C 4 Channel SPDT Relay Board.vi |
| 72 | + |
| 73 | +image::Grove4ChannelSPDTRelayProject.png[] |
| 74 | + |
| 75 | +This particular VI uses the 4 Channel Relay Board. Select the port for the connected Pico and the Grove connector that the board is plugged into. Press the run arrow. |
| 76 | + |
| 77 | +You can now click on the switch symbols and the corresponding relay will toggle matching the symbol. If you want to change the I2C address for multiple boards, you can modify [New Address] and press the load button. It's probably a good idea to mark the board with the new address, although it's fairly easy to ping the addresses of attached modules. |
| 78 | + |
| 79 | + |
| 80 | +image::I2C4ChanSPDTRelayBoardFP.png[] |
| 81 | + |
| 82 | +On the block diagram you can see that the selected Grove connector dictates the GPIO Pin for the IC2 Port. We set up the IC2 port for the device in **Init.vi**. Next we loop round the event structure and wait for a button on the Front Panel to be pressed. When a switch is detected (event:Switch1,Switch2,Switch3 or Switch4) *Set Switch.vi* recieves the required settings. If the Load button is pressed the new board address is entered and the system re-initialise. Pressing Stop will fire the Stop event and exit the loop. |
| 83 | + |
| 84 | + |
| 85 | +image::I2C4ChanSPDTRelayBoardBD.png[] |
0 commit comments