Software
Coming soon.
There are already some basic examples in my Github repository.
Getting started
Compared to the Picoclick-C3T the C3 is optimized to be used with the Arduino framework which is probably great for most users. Of course the ESP-IDF can still be used for the C3, but the flashing configurations don't have to be changed like for the C3T.
I'm always using Visual Studio Code with the PlatformIO plugin to flash my microcontrollers. If you haven't worked with it yet I can recommend going through the quick start guide by Rui Santos (RandomNerdTutorials).
If you have set it up correctly you can simply start by adding a project folder to your workspace. In doing so you have to right click somewhere in the workspace and select "Add Folder to Workspace...". A great way to start is by choosing one of the Picoclick-C3 projects from my Github repository. Once added, the project structure should look like the structure shown in the right image. The two most important files are the main.cpp
which is the file where all the project code goes in and the platform.ini
which is the configuration file of the project. Latter defines what processor you are using, which COM-port the Picoclick is connected to and other build settings.
platform.ini
The project configuration file of your Picoclick project can look like this, where a ;
defines a comment. If the upload_port
and monitor_port
are commented out, PlatformIO will assign these ports automatically. If only one device is connected to your computer this will work fine.
The lip_deps
defines which libraries and which versions are used. The FastLED
library is used to control the APA102 LEDs and thus should be present in every project. If using other libraries these should be added to this list.
config.h
The config.h
file is not neccessary but will clean up your main project file a bit. It defines the hardware definitions of the Picoclick and thus are always the same. Furthermore it contains some useful FastLED things and the function for reading the battery voltage. This file can be included by adding the line #include "config.h"
in your main project and it should look like this:
If the config.h
file isn't used you have to add all these pin definitions in the top of your main.cpp
file.
main.cpp
The main project file includes the code for your board and is similar to the .ino
file for the Arduino IDE.
Following code is a basic example which will change the color of both LEDs if the button is pressed. If the button is press & hold for one second or the button isn't pressed for 10 seconds the Picoclick will turn off by entering the deep sleep mode with esp_deep_sleep_start()
. Again, this won't enter the deep sleep of the ESP32 because the Picoclick will loose power beforehand due to the latching circuit.
Last updated