Hand tools and fabrication machines
LightBlue Explorer's offers some features that enable you to test devices. However, with the Bean, LightBlue also offers a Sandbox view that can interact with the connected Bean. There are three different ways the Sanbox subviews can interact with the Bean. We will be exploring with the track pad view.
* LightBlue App
* Bean Loader App for iOS
* LightBlue Bean
* iOS device
To open the XY trackpad in your LightBlue app:
- Connect to a Bean.
- Select Options in the upper-right corner.
- Select Sandbox View.
- Select the second tab on the bottom of the screen:
*Line 2-3: sets the variables for the control IDs
*Line 5: is the setup function. This function is executed only once during the duration of the program.
*Line 9: is the loop function. This function is executed multiple times.
*Line 13-14: gets the x-axis and y-axis. The map function here is taking the low and high ranges for the acceleration.
*Line18-23: Creates a 4-byte long buffer and assign each index to specific values.
*Line24-26: We type cast buffer to an 8-bit long integer and send it over Serial.
This sketch demonstrates how to send data to a sandbox control. It reads the X and Y axis values from the accelerometer, scales the values to 0-255, and sends them to the trackpad.
For more information on the data format used by Bean Sandbox, check out the Trackpad Control example project.
Having trouble with this guide? Reach out to BeanTalk to get directed feedback from our developers and community!