Book Image

Learning C for Arduino

By : Syed Omar Faruk Towaha
Book Image

Learning C for Arduino

By: Syed Omar Faruk Towaha

Overview of this book

This book will start with the fundamentals of C programming and programming topics, such data types, functions, decision making, program loops, pointers, and structures, with the help of an Arduino board. Then you will get acquainted with Arduino interactions with sensors, LEDs, and autonomous systems and setting up the Arduino environment. Moving on you will also learn how to work on the digital and analog I/O, establish serial communications with autonomous systems, and integrate with electronic devices. By the end of the book, you will be able to make basic projects such as LED cube and smart weather system that leverages C.
Table of Contents (17 chapters)
Learning C for Arduino
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Uses of LiquidCrystal Library


We use the LiquidCrystal library for controlling Liquid Crystal Displays (LCDs). The Liquidcrystal library works best with the Hitachi HD44780 chipset embedded on the LCD displays. This chipset is too common to the text-based displays (cannot display any complex graphics). We have connected the 16x2 LCD display to the Arduino that supports the LiquidCrystal library. To print something on the Display we will first need to import the liquidcrystal.h library to the code as follows:

#include <LiquidCrystal.h>

Now we will define the pins of the Arduino board that we have used to connect the LCD display:

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Here lcd can be renamed to anything you want. But remember we will need to use this in the future code.

Inside the setup() function we will say what kind of display we have connected to the Arduino board as follows:

lcd.begin(16,2);

Our display is 16x2, so we have declared our display with the column numbers and row numbers of...