Our first chipKIT tutorial is about reading and writing digital data (0 or 1) from and to an I/O pin of the chipKIT board. Digital inputs are useful to determine whether an incoming digital signal is logic HIGH or logic LOW. A simple application of digital input is reading the state of a push-button switch and perform some action based on if the switch has been pressed or not. Similarly, digital outputs are used by microcontrollers for many purposes, such as to enable or disable an external chip, drive LEDs and LCD displays, control relay switches, etc. In this tutorial, we will build a very simple circuit using a momentary push-button and an LED, both connected to the digital I/O pins of chipKIT Uno32. The state of the switch is continuously read by Uno32, which then toggles the LED on and off every time the switch is pressed.
Digital input and output