1
I already have a code in the Arduino IDE, in which when passed the letter 'l', an led will be access, however, I can not in any way access this serial port with PHP, I am using Fedora 22, Arduino Uno, the codes are below:
Arduino code, port used /dev/ttyACM0
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
char caracter = Serial.read();
if(caracter == 'l'){
digitalWrite(13, HIGH);
delay(1000);
}
}
PHP code, setting the character 'l'
<?php
$porta = fopen("/dev/ttyACM0", "w");
fwrite($porta, 'l');
fclose($porta);
?>
I gave a var_dump in the variable $port and it returned me false, I appreciate the help of all.
Probably the PHP or apache executable does not have write permissions on
/dev/ttyACM0
, seems to me more likely. I also don’t know if your kernel has the drivers nescessários. Some arduinos "pirates" have specific drivers– Olimon F.
Sure it’s permission I had this same problem on linux, from a chmod 777 /dev/ttyACM0 that will work. !!!
– user49500