Advertise here

Teensy tutorial :Read digital GPIO

Teensy tutorial :  Read digital GPIO  using digitalRead function

Teensy 3.1 has 34 digital I/O"share some pins 
with analog I/O" , in this tutorial I will show you how to read digital pins as an INPUT using digitalRead command.

first you need to set the pin as an OUTPUT using :


pin:any pin (0 - 33).

to read any digital Pin :


to do some advance application , I write a code to 8 buttons and turn on led when any of these buttons pressed.

Schematic : 


you can download the code from HERE

Serial print the button 

now let's improve this code a little bit and once we press the button it will print a message on the Serial monitor

with the same schematic , HERE the code 

after you upload the code the results will be shown on the serial monitor as the image below

No comments

Powered by Blogger.