This is a quickstart explanation of what Adafruit Arcada library provides, see the detailed Doxygen documents for arguments & return values
Initialization
-
arcadaBegin()
must be called first, it will set pin directions, turn off NeoPixels, and check for connected hardware -
filesysBeginMSD()
will initialize the storage method (SD or SPI flash) and check if a proper filesystem exists. On SD cards that's a FAT filesystem (so make sure its formatted). On SPI Flash we use CircuitPython's FAT filesystem, the best way to format is to load CircuitPython on once. If you're using TinyUSB as your USB stack, this will also make the disk drive appear on a computer -
displayBegin()
initializes the display, you will need to turn on the backlight after this is done - we don't do it for you!
Joystick & Buttons
-
readJoystickX
andreadJoystickY
read the analog joystick (if there is one) and returns -512 to 511 with 0 being 'center' (approximately) -
readButtons
returns a 32 bit mask for each button pressed at the moment of the function call - right now only the bottom 8 bits are used. CheckAdafruit_Arcada_Def.h
for the button mask names. Analog joysticks are checked against a threshold and 'emulate' a button press
Some boards, like the MONSTER M4SK and HalloWings, do not have a proper joystick - instead we will return the capacitive touch pads or buttons as if there was a joystick. For example, the M4SK's three buttons will return 'up', 'A' and 'down' respectively.
- After
readButtons
is called,justPressedButtons
will tell you buttons were pressed as of thereadButtons
call - Ditto for
justReleasedButtons
Backlight, Speaker and Sensors
- Enable/disable speaker amplifier (if there is one) with
enableSpeaker
- this doesn't affect headphones if there are any -
readBatterySensor
returns the battery voltage detected. You cannot detect whether a battery is being charged, only the voltage. -
readLightSensor
will return 0 for dark, 1023 for bright surrounding light. -
setBacklight
can set the backlight from 0 (off) to 255 (all the way on)
Alert Boxes
These info boxes and alert display on the screen to let the user know something they need to do, get ready for, or went wrong. You can have the alert wait for a button press or have it return immediately (then you can delay or wait for something else to occur)
-
alertBox
is the generic, you can set the message, box and text color, as well as button press -
infoBox
is analertBox
where the default button is A and the box color is white, text color is black -
warnBox
is analertBox
where the default button is A and the box color is yellow, text color is black -
errorBox
is analertBox
where the default button is A and the box color is red, text color is white -
haltBox
is analertBox
where the box color is red, text color is white. It will sit in a busy loop and never return
Page last edited March 08, 2024
Text editor powered by tinymce.