24 lines
		
	
	
		
			430 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			24 lines
		
	
	
		
			430 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								require_once __DIR__."/../vendor/autoload.php";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * This example demonstrate a possibility, but not a best practice. When using
							 | 
						||
| 
								 | 
							
								 * the tick handler, make sure the code being executed has ticks declared.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use NoccyLabs\Gpio\Gpio;
							 | 
						||
| 
								 | 
							
								use NoccyLabs\Gpio\GpioTickHandler;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$gpio = new Gpio(true);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$gpiotick = new GpioTickHandler();
							 | 
						||
| 
								 | 
							
								$gpiotick->registerGpio($gpio);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								declare(ticks=5);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								while(true) {
							 | 
						||
| 
								 | 
							
								    usleep(10000);
							 | 
						||
| 
								 | 
							
								}
							 |