Microsoft excel has proven over the years to be a useful tool for education and professional use alike. Thanks to the BrainPad, excel now has access to the physical world! With the next few steps, we will see how we can use excel to control some physical elements.
DUE Link Pre-Setup
DUE Link allows devices to be connected to a PC that is programmed is any programming language, including python. To prep you BrainPad to work with Excel, it needs to be loaded with DUE Link software.
Visit the DUE Link Console and click firmware option in the top menu.
Note that you do not need to use the console. You are only using it for the firmware update feature. This step is only necessary if the board is not already loaded with the latest DUE Link firmware and only needs to be once. Come back here to continue with Python.
Blink LED
Excel communicates with the BrainPad using a feature called Excel Data Streamer plug-in. This plug-in is already included with excel and only needs to be Enabeled.
To enable Data Streamer plug-in:
- got to File -> Options
- In the Excel Options dialog click Add-ins
- At the bottom of the dialog in the Manage: drop-down select COM Add-ins and click Go
- Check the box for Microsoft Data Streamer for Excel
You should now see the Data Streamer tab in the Excel ribbon.
Clicking the connect device button will reveal the available COM ports. If you have more than one port, you can use the DUE Console to determine the right one. Click connect and the needed COM would have SC13 or SC007 in its description.
Once connected, Excel will bring in four worksheets (Data In, Data Out, Settings, and Manifest). The default settings are okay except we need to change data channels to 1. Open the settings worksheet and modify.
Excel is now ready to send data to BrainPad. Open Data Out worksheet and enter Led(200, 800, 3)
This command will blink the onboard LED 3 times.
Button Control
A button can be used to control a function, like to blink and LED. We need ActiveX button.
The Developer tab isn’t displayed by default, but you can add it to the ribbon.
- On the File tab, go to Options > Customize Ribbon.
- Under Customize the Ribbon and under Main Tabs, select the Developer check box.
With the Design Mode active, right-click the button and change its name and label to Blink.
Now double-click the button to view its code and modify the code as shows.
Private Sub Blink_Click()
Worksheets("Data Out").Range("A5").Value = "Led(200, 800, 2)"
End Sub
Congrats! Now clicking the button will blink the LED twice.
Similarly, any other excel components can be added to send commands. Can you add a button that takes a specific cells value to set a servo’s position?
Get Coding!
We barely scratched the surface of the possibilities. Excel supports full coding using Visual Basic. A user needs t understand the DUE Script standard library and then from there they can fully access the BrainPad from Excel.
Start by mastering DUE Script and then you will be unstoppable with Excel!