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 :
pinMode(pin,State);
pin:any pin (0 - 33).
state:OUTPUT or INPUT
to read any digital Pin :
digitalRead(pin);
to do some advance application , I write a code to 8 buttons and turn on led when any of these buttons pressed.
Schematic :
code:
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
Schematic :
code:
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
Hi, i need USB host keyboard with Teensy 4.11 board example.
ReplyDelete