# bs_example

Peripheral example program.

### Synopsis

`bs_example`

### Description

This demonstration program lets you move a cel (a cloud) around the screen with a joystick and leave an image of it on the screen when you press the trigger. You can also distort the cel and clear the screen. The program supports control pad, joystick, and mouse interaction.

This example illustrates how to use the broker shell peripheral interaction utilities.

The connection/configuration/disconnection routines can be used as-is in final code.

The data interaction/processing is less efficient than it could be for the sake of modularity, comprehensibility, and flexibility. If you unpack the`BS_NiceWaitEvent()` and `BS_ProcessXxxData()` routines and perform that processing in a more direct way performance will improve. You should also eliminate any debouncing checks that you don't use.

Joystick controls

Stick
  move in x and y

Z
  zoom in/out U/D/

L/R switch
  deform cel

Trigger
  leave copy of cel on screen

A
  clear screen

B
  recalibrate stick (to recalibrate, hit B with stick in neutral position and move the stick and z throttle to the limits of travel)

C
  quit

RightShift
  switch to mouse

Mouse controls

LeftButton
  leave copy of cel on screen

MiddleButton
  clear screen

Movement
  move cel in x and y

Pad 1 controls (used with mouse):

RightButton
  switch to joystick

D Pad
  distort cel

C Button
  quit

RightShift
  toggle mouse edge conditions between bound & wrap

Pad 2 controls (only if there are 2 pads and no mouse):

D Pad
  move cel

A Button
  leave copy of cel on screen

B Button
  clear screen

C Button
  switch to joystick control

RightShift
  toggle movement speed between high & low

### Caveats

Lightgun support is not yet included in this example.

### Associated Files

cloud.cel

### Location

examples/EventBroker/Control_Port_Peripherals