The Crickit HAT for Raspberry Pi is not programmable in Arduino.

The microcontrollers installed on top of Crickit communicate to execute Crickit commands via the seesaw chip located on the Crickit. Seesaw is a helper microcontroller which talks to the main microcontroller via the serial I2C protocol. There is a bit of setup to get things working in your Arduino code but it is not difficult.

Download Adafruit_Seesaw library

To begin using your Crickit with the Arduino IDE, you will need to install the Adafruit_seesaw library.

Start up the IDE and open the Library Manager:

Type in seesaw until you see the Adafruit Library pop up. Click Install!

We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

Arduino with micro:bit

For basic usage of Arduino with the micro:bit, see this tutorial to get started

Once you have the basic support down, you can use an attached Crickit via the Seesaw library.

Using Arduino with both micro:bit and the Seesaw library is not generally a beginner level experience. We recommend this be for intermediate or more advanced coders.

Pin Definitions for Seesaw and Crickit

There are two files you should include in your sketches, Adafruit_seesaw.h and Adafruit_Crickit.h. Pin definitions for controlling Crickit functions are in Adafruit_Crickit.h for reference.

#ifndef _CRICKIT_TERSTER_H
#define _CRICKIT_TERSTER_H

#include "Adafruit_seesaw.h"

#define CRICKIT_SIGNAL1 2
#define CRICKIT_SIGNAL2 3
#define CRICKIT_SIGNAL3 40
#define CRICKIT_SIGNAL4 41
#define CRICKIT_SIGNAL5 11
#define CRICKIT_SIGNAL6 10
#define CRICKIT_SIGNAL7 9
#define CRICKIT_SIGNAL8 8

#define CRICKIT_SERVO4 14
#define CRICKIT_SERVO3 15
#define CRICKIT_SERVO2 16
#define CRICKIT_SERVO1 17

#define CRICKIT_MOTOR_A1 22
#define CRICKIT_MOTOR_A2 23
#define CRICKIT_MOTOR_B1 19
#define CRICKIT_MOTOR_B2 18
#define CRICKIT_DRIVE1 13
#define CRICKIT_DRIVE2 12
#define CRICKIT_DRIVE3 43
#define CRICKIT_DRIVE4 42

#define CRICKIT_TOUCH1 0
#define CRICKIT_TOUCH2 1
#define CRICKIT_TOUCH3 2
#define CRICKIT_TOUCH4 3

#define CRICKIT_DUTY_CYCLE_OFF 0
#define CRICKIT_DUTY_CYCLE_MAX 65535

/**************************************************************************/
/*!
    @brief  Class that stores state and functions for interacting with Crickit
   variant of seesaw helper IC
*/
/**************************************************************************/
class Adafruit_Crickit : public Adafruit_seesaw {
public:
  Adafruit_Crickit(){};
  ~Adafruit_Crickit(){};

  void analogWrite(uint8_t pin, uint16_t value, uint8_t width = 8);
  uint16_t analogRead(uint8_t pin);
  void setPWMFreq(uint8_t pin, uint16_t freq);
};

#endif

This guide was first published on May 16, 2018. It was last updated on Dec 09, 2023.

This page (Arduino Code) was last updated on May 21, 2018.

Text editor powered by tinymce.