SpinWheel Functions Appendix

Table of Contents

This document lists some of the most important functions available with the SpinWheel code library. With these functions you can detect motion and set the LEDs to different color patterns. If you have never programmed with Arduino before, be sure to read our quick start guide and SpinWheel basic programming page. To learn more about the building blocks of coding, check out the programming patterns page. For more details, you can consult the annotated source code, listing everything available in the library. This will serve as a reference as you code the SpinWheel in whatever designs you imagine.

You can use the virtual SpinWheel simulator to test each of these functions. If a function involves the motion sensor, you can grab the virtual device with your mouse and shake it, simulating how the physical sensor would respond to real motion.

LED Manipulation

There are a number of functions that let you manipulate the state of the LEDs, however, for the LEDs to actually respond to these manipulations, you also need to call SpinWheel.drawFrame() when you are done. That way you can make multiple modifications, preparing the final image, without the intermediate unfinished images showing up.

If you want to reset the image, you can call SpinWheel.clearAllLEDs(), which will set all LEDs to be dark, deleting any color information that they were previously set to.

Turn on all the Large LEDs with setLargeLEDsUniform

setLargeLEDsUniform takes three arguments, the red, green, and blue components of the desired color. Their range is between 0 and 255 (one byte).

void loop() {
}

Turn on all the Small LEDs with setSmallLEDsUniform

setSmallLEDsUniform, same as setLargeLEDsUniform, takes three arguments, the red, green, and blue components of the desired color. Their range is between 0 and 255 (one byte).

void loop() {
}

Control a Specific Large LED with setLargeLED

The first argument of setLargeLED is a number between 0 and 7, denoting which of the 8 LEDs is to be turned on. The other three arguments are the red, green, and blue components of the color.

void loop() {
}

Control a Specific Small LED with setSmallLED

The first argument of setSmallLED is a number between 0 and 11, denoting which of the 12 LEDs is to be turned on. The other three arguments are the red, green, and blue components of the color.

void loop() {
}

Turn on a range of Large LEDs with setLargeLEDs

The first and second arguments of setLargeLEDs are numbers between 0 and 7, denoting what range of the 8 LEDs is to be turned on. The other three arguments are the red, green, and blue components of the color.

void loop() {
}

Turn on a range of Small LEDs with setSmallLEDs

The first and second arguments of setSmallLEDs are numbers between 0 and 11, denoting what range of the 12 LEDs is to be turned on. The other three arguments are the red, green, and blue components of the color.

void loop() {
}

Set overall brightness with setBrightness

This function takes only one argument, between 0 and 255, that sets the brightness of the LEDs. At maximal settings the large LEDs are blindingly bright and pull a total current of 480 mAh, which would deplete our battery in less than 10 minutes. Using the maximal setting would cause the battery to wear out much quicker and would cause significant heating.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. © SpinWearables LLC (license and trademark details)