edit

Using the Grove Analog Port on Wio Terminal

This repo demonstrates how to use Analog as inputs on Wio Terminal. To use analog pins on Wio Terminal, you must use RPI pins.

RPI Analog Pins

The Raspberry Pi pinouts are defined as:

  • RPI_A0 -> RPI_A8

Grove Port Configurations

To use the Grove configurable A/D Port as Analog port, simply define it as follow:

1
2
3
void setup() {
    pinMode(A0, INPUT);
}

Now, connect your Grove sensor to the physical pin!

Example Code

In this example, a Grove Loudness sensor is used to demonstrate:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
void setup() {
    Serial.begin(115200);
    pinMode(A0, INPUT);
}
void loop() {
    int loudness = analogRead(RPI_A0);
    Serial.print("Loudness: ");
    Serial.println(loudness);
    delay(50);
}