We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# !/usr/bin/perl # test1.pl use wiringpi; use constant { OUTPUT=>1, INPUT=>0, HIGH=>1, LOW=>0 }; $SIG{'INT'}=&safe_exit; $SIG{'QUIT'}=&safe_exit; $SIG{**DIE**}=&safe_exit; print("Raspberry Pi wiringPi test program\n"); if( wiringpi::wiringPiSetup()==-1 ){ die 1; } for( my $pin=0;$pin<8;++$pin ){ wiringpi::pinMode($pin,OUTPUT); } wiringpi::pinMode(8,INPUT); @data=( [0,1,1], [1,1,1], [0,0,0],[2,1,1], [1,0,0],[3,1,1], [2,0,0],[4,1,1], [3,0,0],[5,1,1], [4,0,0],[6,1,1], [5,0,0],[7,1,1], [6,0,1], [7,0,1], [7,1,1], [6,1,1], [7,0,0],[5,1,1], [6,0,0],[4,1,1], [5,0,0],[3,1,1], [4,0,0],[2,1,1], [3,0,0],[1,1,1], [2,0,0],[0,1,1], [1,0,1], [0,0,1], [9,9,9] ); my $inc=0; while( 1==1 ){ my( $pin,$state,$duration )=@{$data[$inc]}; if( $pin+$state+$duration==27 ){ $inc=0; next; } wiringpi::digitalWrite($pin,$state); if( wiringpi::digitalRead(8)==LOW ){ wiringpi::delay($duration_10); }else{ wiringpi::delay( $duration_100 ); } ++$inc; } # this just turns off all the LEDs when you exit the script sub safe_exit{ for( my $pin=0;$pin<8;++$pin ){ wiringpi::digitalWrite($pin,LOW); } exit 1; }
The text was updated successfully, but these errors were encountered:
This is super useful, thank you. I've tweaked your comment to wrap the code in Syntax highlighting markup so it looks all nice here ;)
Sorry, something went wrong.
Test file derived from #4
0e10a96
No branches or pull requests
The text was updated successfully, but these errors were encountered: