File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
[ ![ Codacy Badge] ( https://api.codacy.com/project/badge/Grade/3d57a79cbf3245e0af61e9123fda26eb )] ( https://www.codacy.com/app/matheus-marabesi/arduino-php-wrapper?utm_source=github.com&utm_medium=referral&utm_content=marabesi/arduino-php-wrapper&utm_campaign=badger )
4
4
[ ![ Build Status] ( https://travis-ci.org/marabesi/arduino-php-wrapper.svg?branch=master )] ( https://travis-ci.org/marabesi/arduino-php-wrapper )
5
+ [ ![ Latest Stable Version] ( https://poser.pugx.org/marabesi/arduino-php-wrapper/v/stable )] ( https://packagist.org/packages/marabesi/arduino-php-wrapper )
6
+ [ ![ Total Downloads] ( https://poser.pugx.org/marabesi/arduino-php-wrapper/downloads )] ( https://packagist.org/packages/marabesi/arduino-php-wrapper )
7
+ [ ![ composer.lock] ( https://poser.pugx.org/marabesi/arduino-php-wrapper/composerlock )] ( https://packagist.org/packages/marabesi/arduino-php-wrapper )
5
8
6
9
If you are wondering how to control the Arduino serial port via PHP, here is the solution.
7
10
The ** arduino://** wrapper is a easy and straightforward way to write and read data from Arduino.
@@ -15,7 +18,7 @@ to write date on Arduino serial just use the regular I/O functions in PHP such a
15
18
16
19
//reads data from Arduino
17
20
$resource = fopen('arduino://ttyUSB0', 'r+');
18
- print fread($resource, 1024);
21
+ print fread($resource, 1024);
19
22
```
20
23
21
24
Or if you prefer, you can use ** file_get_contents** and get the same result
@@ -30,7 +33,7 @@ To write data in the Arduino serial is as easy as it could be
30
33
31
34
//writes data to Arduino
32
35
$resource = fopen('arduino://ttyUSB0', 'r+');
33
- print fwrite('hello Arduino');
36
+ print fwrite('hello Arduino');
34
37
```
35
38
36
39
``` php
You can’t perform that action at this time.
0 commit comments