The seesaw firmware that ships with the ATtinyxxx breakouts includes analog capabilities on specific pins. This example reads the analog value of a pin.

Follow the steps on the Arduino page to get set up.

Analog Pins

The ATtiny817 breakout with seesaw firmware provides analog on the following pins:

  • 0-3, 6, 7, 18-20

The ATtiny816 and ATtiny1616 breakout with seesaw firmware provides analog on the following pins:

  • 0-5, 14-16

Example Code

Open up File -> Examples -> Adafruit Seesaw -> analog -> analogRead and upload to your Arduino wired up to the breakout.

/*
 * This example shows how read the ADC on a seesaw. 
 * The default ADC pins on the SAMD09 Breakout are 2, 3, and 4.
 */

#include "Adafruit_seesaw.h"

Adafruit_seesaw ss;
// on SAMD09, analog in can be 2, 3, or 4
// on Attinyxy7, analog in can be 0-3, 6, 7, 18-20
// on Attinyxy6, analog in can be 0-5, 14-16
#define   ANALOGIN   2

void setup() {
  Serial.begin(115200);
  
  while (!Serial) delay(10);   // wait until serial port is opened
  
  if(!ss.begin()){
    Serial.println(F("seesaw not found!"));
    while(1) delay(10);
  }
  
  Serial.println(F("seesaw started OK!"));
}

void loop() {
  Serial.println(ss.analogRead(ANALOGIN));
  delay(50);  
}

Once you've successfully loaded the sketch onto your board, open the Serial Monitor (Tools->Serial Monitor). Your output should look something like the following.

This guide was first published on Oct 20, 2021. It was last updated on Oct 20, 2021.

This page (Analog In) was last updated on Oct 19, 2021.

Text editor powered by tinymce.