Tobias Krieger wrote:
> So, what I need is a way to convert any value between 0 and 255 into a
> string with one byte, e.g
>
> 0xff = 1111 1111 (with strlen($data) == 1)
>
> I tried it with:
>
> chr(255) - not successfull
> pack("H" and "h", 0xff) - not successfull
> decbin(255) - without success
>
> And many more variations....
> Any ideas, suggestions, .... Thanks!
I tried the following:
$d=chr(255);
$f=fopen('klop','w');
fwrite($f,$d);
fclose($f);
The produces a file called 'klop' containing exactly one byte = 0xFF.
That should work with your /dev/i2c interface as well - if not,
something else is getting in your way.
/Per
--
Per Jessen, Zürich (16.9°C)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php