Serial output

The standard serial console is not present for the Picoclick as it uses the USB-CDC interface to communicate with the processor. Writing to the standard console with Serial.print("...") will output the data to the UART interface which is not connected on the Picoclick.

Nevertheless there is still a way to use the Serial console. This is as easy as using printf("...") instead of Serial.print("..."). Furthermore the Serial console don't need to be initialized with something like Serial.begin(X).

A basic example which will write the battery voltage of the Picoclick to the serial console:

#include <Arduino.h>
#include <WiFi.h>
#include "config.h"

void setup(){
  pinMode(BUTTON_PIN, INPUT);
  pinMode(ADC_ENABLE_PIN, OUTPUT);
  pinMode(ADC_PIN, INPUT);
  analogReadResolution(12);
  digitalWrite(ADC_ENABLE_PIN, HIGH);

  btStop();
  WiFi.mode(WIFI_OFF);

  FastLED.addLeds<APA102, APA102_SDI_PIN, APA102_CLK_PIN, BGR>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  FastLED.setBrightness(160);
  delay(50);

  set_fastled(CRGB::Blue);

  printf("Setup done!\r\n");
}

void loop() {
  printf("Battery voltage: %i mV\r\n", int(get_battery_voltage()));
  delay(500);
}

Make sure that you don't forget to add the carriage return (\r) and the line feed (\n) to the end of the string.

To open the serial monitor in PlatformIO you have to press the button with power adapter in the bottom left corner.

Last updated