The code below requires "php_serial.class.php". Download it to the same folder where you save this code:
// hello from php.php
<?php
if(isset($_REQUEST['message'])){
$msg=$_REQUEST['message'];
require("php_serial.class.php");
$serial = new phpSerial();
$serial->deviceSet("/dev/ttyACM0"); // Arduino usb-port
$serial->confBaudRate(115200); //baud rate
$serial->confParity("none"); //Parity
$serial->confCharacterLength(8); //Character length
$serial->confStopBits(1); //Stop bits
$serial->confFlowControl("none");
$serial->deviceOpen(); // open connection
$serial->sendMessage($msg); //send the message
}
?>
<html><body>
<h3>If you're running Linux: remember to give permissions to www-data to access usbport ($ sudo chmod 777 /dev/ttyACM0)</h3>
<a href="hello_from_php.php?message=HelloFromPhp">Send hello message</a>
</body></html>If you are not getting any data to Arduino, you must first (and every time you connect usb) give permissions to www-data to access your Arduino usb-port.
Try the example above with "Arduino: How to read serial to string" for best results!
If you don't remember this, your car may be stolen!
ReplyDeleteImagine that your vehicle was taken! When you visit the police, they inquire about a specific "VIN search"
A VIN decoder is what?
Similar to a passport, the "VIN decoder" allows you to find out the date of the car's birth and the identity of its "parent" (manufacturing facility). You can also find out:
1.Type of engine
2.Model of a vehicle
3.The limitations of the DMV
4.Number of drivers in this vehicle
You will be able to locate the car, and keeping in mind the code ensures your safety. The code can be viewed in the online database. The VIN is situated on various parts of the car to make it harder for thieves to steal, such as the first person sitting on the floor, the frame (often in trucks and SUVs), the spar, and other areas.
What if the VIN is intentionally harmed?
There are numerous circumstances that can result in VIN damage, but failing to have one will have unpleasant repercussions because it is illegal to intentionally harm a VIN in order to avoid going to jail or the police. You could receive a fine of up to 80,000 rubles and spend two years in jail. You might be held up on the road by a teacher.
Conclusion.
The VIN decoder may help to save your car from theft. But where can you check the car reality? This is why we exist– VIN decoders!