Summer Camps 2025 registration is open — spots are limited.Reserve yours →
Technical Reference

Documentation

API reference, pinout diagrams, libraries, and example projects.

PiCo Documentation

Welcome to the PiCo technical reference. This covers hardware specifications, API documentation, library usage, and complete code examples for all boards in the PiCo family.

📌 New to PiCo? Start with the Learn section for step-by-step tutorials before diving into this reference.

Board Comparison

FeaturePiCo NANOPiCo COREPiCo WIFIPiCo PRO
MCUATmega328PATmega2560ESP32STM32H743
Clock16 MHz16 MHz240 MHz480 MHz
Flash32 KB256 KB4 MB2 MB
SRAM2 KB8 KB520 KB + 8 MB PSRAM1 MB
Digital I/O225438168
ADC8 ch / 10-bit16 ch / 10-bit18 ch / 12-bit36 ch / 16-bit
WiFi / BT802.11 b/g/n + BT 5— (module option)
CAN / EthernetCAN FD + Ethernet
Temp range0–70°C0–70°C–40–85°C–40–85°C
Price (MAD)199349449749

API Reference — Core Functions

PiCo CORE and NANO expose the standard Arduino API. The functions below are available on all boards.

pinMode(pin, mode)

Configures a pin as INPUT, OUTPUT, or INPUT_PULLUP.

C++
pinMode(13, OUTPUT);        // set pin 13 as output
pinMode(2,  INPUT_PULLUP);  // internal pull-up resistor

digitalWrite / digitalRead

C++
digitalWrite(13, HIGH);     // set pin HIGH (5V)
digitalWrite(13, LOW);      // set pin LOW  (0V)
int val = digitalRead(2);   // returns HIGH or LOW

analogRead / analogWrite

C++
int raw = analogRead(A0);   // 0–1023 (10-bit)
float v = raw * (5.0 / 1023.0); // convert to volts

analogWrite(9, 128);        // PWM: 0–255 (50% duty)

Serial (UART)

C++
Serial.begin(115200);         // UART0 at 115200 baud
Serial.print("value: ");
Serial.println(42);

// PiCo CORE has 4 hardware UARTs:
Serial1.begin(9600);          // pins TX1/RX1
Serial2.begin(9600);          // pins TX2/RX2

I²C (Wire)

C++
#include <Wire.h>

void setup() {
  Wire.begin();              // join I²C bus as master
}

// Write a byte to device at address 0x27
Wire.beginTransmission(0x27);
Wire.write(0x00);            // register
Wire.write(0xFF);            // value
Wire.endTransmission();

// Read 2 bytes from address 0x68
Wire.requestFrom(0x68, 2);
byte hi = Wire.read();
byte lo = Wire.read();

SPI

C++
#include <SPI.h>

const int CS = 10;

void setup() {
  SPI.begin();
  pinMode(CS, OUTPUT);
  digitalWrite(CS, HIGH);
}

void spiWrite(byte reg, byte val) {
  SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
  digitalWrite(CS, LOW);
  SPI.transfer(reg);
  SPI.transfer(val);
  digitalWrite(CS, HIGH);
  SPI.endTransaction();
}

Timers & PWM

PiCo CORE has 6 hardware timers providing 15 PWM outputs. Default PWM frequency is 490Hz (pins 5, 6: 980Hz).

C++
// Change Timer2 prescaler for ~31kHz PWM on pins 9, 10
TCCR2B = TCCR2B & B11111000 | B00000001; // 31372 Hz

// Hardware timer interrupt (Timer1, 1 Hz)
#include <TimerOne.h>
Timer1.initialize(1000000); // 1 second in microseconds
Timer1.attachInterrupt(myISR);

PiCo Sensor Libraries

Install via Arduino Library Manager or clone from github.com/PiCoAcademy.

LibrarySensorProtocolInstall name
PiCo_DHTDHT11/22 Temp + Humidity1-WirePiCo_DHT
PiCo_BMPBMP280 Pressure + TempI²C / SPIPiCo_BMP
PiCo_USHC-SR04 UltrasonicTrigger/EchoPiCo_US
PiCo_MPUMPU6050 Gyro/AccelI²CPiCo_MPU
PiCo_LCD16×2 LCD (I²C)I²CPiCo_LCD

Example: MQTT (PiCo WIFI)

Publish sensor data to an MQTT broker using the PiCo WIFI board and the PubSubClient library.

Arduino / C++ · PiCo WIFI
#include <WiFi.h>
#include <PubSubClient.h>
#include <DHT.h>

const char* SSID     = "YourWiFi";
const char* PASSWORD = "YourPass";
const char* BROKER   = "broker.hivemq.com";

WiFiClient   net;
PubSubClient mqtt(net);
DHT          dht(4, DHT22);

void connectWiFi() {
  WiFi.begin(SSID, PASSWORD);
  while (WiFi.status() != WL_CONNECTED) delay(500);
}

void connectMQTT() {
  while (!mqtt.connected()) {
    mqtt.connect("PiCoWIFI");
    delay(1000);
  }
}

void setup() {
  Serial.begin(115200);
  dht.begin();
  connectWiFi();
  mqtt.setServer(BROKER, 1883);
  connectMQTT();
}

void loop() {
  if (!mqtt.connected()) connectMQTT();
  mqtt.loop();

  float t = dht.readTemperature();
  float h = dht.readHumidity();

  char buf[32];
  snprintf(buf, sizeof(buf), "%.1f", t);
  mqtt.publish("pico/temperature", buf);
  snprintf(buf, sizeof(buf), "%.1f", h);
  mqtt.publish("pico/humidity", buf);

  delay(10000); // publish every 10 seconds
}

Example: I²C Scanner

Scans all 127 I²C addresses and prints detected devices to Serial Monitor.

Arduino / C++
#include <Wire.h>

void setup() {
  Wire.begin();
  Serial.begin(9600);
  Serial.println("I2C Scanner — PiCo.ma");

  for (byte addr = 1; addr < 127; addr++) {
    Wire.beginTransmission(addr);
    byte error = Wire.endTransmission();

    if (error == 0) {
      Serial.print("Device found at 0x");
      if (addr < 16) Serial.print("0");
      Serial.println(addr, HEX);
    }
  }
  Serial.println("Scan complete.");
}

void loop() {}