This is a very simple example which samples ADC channel 0 at 1Hz. This ADC channel is mapped to the module's pin PD0 (Pad #2) which is available in the WSTK expansion header on pin 4, right next to the VMCU pin.
The ADC reference is configured as Buffered VDD with the following line in the hardware configuration:
<adc reference="2" />
Any analog signal referenced to the same ground as the module and with a dynamic range of 0V to VDD (which is 3.3V if the kit is powered from USB) can be measured.
The ADC has 12 bits resolution and this example prints out via UART0 the raw ADC result value without any mathematical conversion so you will see values between 0 and 2^12-1 = 4095.
To test this example you can simply put a wire from PD0 to GND and see the result go to 0...
... or wire PD0 to VMCU and see the result go to 4095.
Update
If you don't have a jump wire then it's easier to use the expansion board with the analog joystick. The project 'adc_example_joystick' samples PD4 instead of PD0 at a higher rate of 10Hz and prints out the raw value. You will see it changing when moving the joystick as well as an 'X' when you move the joystick left or right as shown in the screenshot below. The joystick in the expansion board has 9 measurable positions and uses different resistor values to create measurable voltages in each of the 9 positions. A block diagram is available in UG172 - WSTK User Guide.
This configures timer 0 to use location 4 which maps CC channels 1 and 2 to PC0 and PC1 respectively. These two pins are connected to the WSTK LEDs which will then allow us to use PWM to drive the LEDs. The timer prescaler divides the peripheral clock of 48MHz by 1024 resulting in a timer clock signal of 46.875 kHz. We will also configure the timer to count from 0 to 100 and wrap around back to 0 so our PWM frequency will be 468Hz.
Note: The timer configuration can also be modified in run-time with the BGAPI command hardware_timer_init.
BGScript Application
The application will create a breathing effect on LEDs 0 and 1 of the WSTK going in opposite directions: when LED0 brightness is ramping up LED1 brightness is ramping down and vice-versa.
We are using a soft timer which triggers every 5 milliseconds to increments/decrements the PWM value by 1 which will change the PWM duty-cycle by 1% on both LEDs.
Wi-Fi Knowledge Base
[BGScript]: ADC example for WGM110
[BGScript]: Breathing LED on WGM110 using soft timer and hardware timers