Reading from digital components
Push buttons are digital. They are either pressed or released. There are some touch buttons that work just like push buttons. They generate a HIGH
signal when touched. There are some sensors that work as HIGH
/LOW
digital input devices. They just give information if the threshold value is reached or not. For example, some IR sensors come with a digital pin that gives only a HIGH
/LOW
value if it detects an obstacle in between a specific distance. Any electronic device capable of generating a HIGH
/LOW
signal can be treated as an input device. This signal is sensed at the connected BeagleBone pin and the input value is interpreted as HIGH
/LOW
. These are all digital input devices.
The BoneScript library provides the function digitalRead()
to read from digital components. The function digitalRead()
requires the pin to be initialized first using the function pinMode()
similar to digitalWrite()
. But it should be initialized for input unlike digitalWrite()
. Here is...