O'Reilly logo

Programming the BeagleBone by Yogesh Chavan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading from analog components

Digital components can fit in Boolean data type. Floating point data type is correct to describe analog values. BoneScript provides the function analogRead() to read the voltage at the analog pin. These pins are input-only. So, there is no need to initialize them using pinMode(). Here is the prototype of the analogRead() function:

analogRead(pin, callback)

The parameters of this function are described as follows:

  • pin: BeagleBone pin identifier string
  • callback: Name of function that will be called automatically when analogRead() finishes.

The first parameter pin is used to find the corresponding sysfs file to read data from. Similar to the digitalRead() function, the analogRead() function is blocking. It waits till analog ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required