examples: Cleanup Python examples
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
c7faa20c14
commit
eda9d03547
@@ -21,14 +21,21 @@
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Example Usage: Reads integer and float value from ADC
|
||||
|
||||
import mraa
|
||||
|
||||
print (mraa.getVersion())
|
||||
print(mraa.getVersion())
|
||||
|
||||
try:
|
||||
# initialise AIO
|
||||
x = mraa.Aio(0)
|
||||
print (x.read())
|
||||
print ("%.5f" % x.readFloat())
|
||||
|
||||
# read integer value
|
||||
print(x.read())
|
||||
|
||||
# read float value
|
||||
print("%.5f" % x.readFloat())
|
||||
except:
|
||||
print ("Are you sure you have an ADC?")
|
||||
print("Are you sure you have an ADC?")
|
||||
|
||||
Reference in New Issue
Block a user