Skip to content

Instantly share code, notes, and snippets.

@hollie
Created September 5, 2021 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hollie/2300e1c6df804d29d24adcdaaecd44b0 to your computer and use it in GitHub Desktop.
Save hollie/2300e1c6df804d29d24adcdaaecd44b0 to your computer and use it in GitHub Desktop.
Example I2C code on SAMD21 for Martin
// vi:ts=4
// ----------------------------------------------------------------------------
// HelloWorld - simple demonstration of lcd
// Created by Bill Perry 2016-07-02
// bperrybap@opensource.billsworld.billandterrie.com
//
// This example code is unlicensed and is released into the public domain
#include <Wire.h>
#include <hd44780.h> // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header
hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip
// LCD geometry
const int LCD_COLS = 16;
const int LCD_ROWS = 2;
void setup()
{
int status;
status = lcd.begin(LCD_COLS, LCD_ROWS);
if(status) // non zero status means it was unsuccesful
{
// hd44780 has a fatalError() routine that blinks an led if possible
// begin() failed so blink error code using the onboard LED if possible
hd44780::fatalError(status); // does not return
}
// initalization was successful, the backlight should be on now
// Print a message to the LCD
lcd.print("CQ CQ ON4CBK");
lcd.setCursor(4,2);
lcd.print("de ON8HZ :-)");
}
void loop() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment