From 0e10a96df811451f5c556dde3cb839009000349f Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 31 Oct 2016 16:35:31 +0000 Subject: [PATCH] Test file derived from #4 --- test.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 test.pl diff --git a/test.pl b/test.pl new file mode 100755 index 0000000..9d229e8 --- /dev/null +++ b/test.pl @@ -0,0 +1,20 @@ +#!/usr/bin/perl + +# Borrowed from https://github.com/WiringPi/WiringPi-Perl/issues/4 - thank you ;) + +use wiringpi; +use constant { + OUTPUT=>1, + INPUT=>0, + HIGH=>1, + LOW=>0 +}; + +if( wiringpi::wiringPiSetup()==-1 ){ + die 1; +} + +wiringpi::pinMode(8,INPUT); + +print("Reading pin BCM 2 (SDA) which has a hardware pull-up\n"); +print("result should be 1: ".wiringpi::digitalRead(8)."\n");