Control Arduino ports via Serial communication

I need to control some wall outlets to turn them on or off at different moments in the day. I will use this to control the events in the fish tank of my wife. To tell the Arduino when to turn on or off ports, which are connected to relays, I have a PHP script that sends commands to the COM port which is connected to the Arduino.

The commands that I am sending are: 3:255&4:0&8:180. This puts the level on the analog port 3 (C02 gas) on the maximum, turns port 4 (bubbles) off and puts port 8 (Lights) at level 180. During the day, different values are sent.

This is the Arduino script that is behind this:

 

Posted in Uncategorized.

Leave a Reply

Your email address will not be published. Required fields are marked *