If you don't
have any experience and are not qualified for working with MAINS power I
will not encourage you to play arround!. The
author take no responsibility for any injury or
death resulting, directly or indirectly, from your inability to
appreciate the hazards of household mains voltages.

The circuit diagrams are as accurately as possible, but are offered with no
guarantees whatsoever.

There is no guarantee that this design meets any Rules which may be in
force in your country so please check before your local
rules/regulations.

Demonstrates the sending data from the computer to the Arduino board, in this case to control the brightness of MPDMv4 AC MAINS Dimmer. The data is sent in individual bytes, each of which ranges from 0 to 255. Arduino reads these bytes and uses them to set the VCNT brightness command .

The circuit: MPDMv4 Board attached from digital pin 3 to ground. Serial connection to Processing, Max/MSP, or another serial application

created 2006 by David A. Mellis modified 30 Aug 2011 by Tom Igoe and Scott Fitzgerald modified 14 Apr 2016 by TJ for esp8266-projects.com AC MAINS Power Dimmer MPDMv4 Driver This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/Dimmer

*/

const int vcntPin = 3; // the pin that the MPDMv4 VCNT pin is attached to

// check if data has been sent from the computer: if (Serial.available()) { // read the most recent byte (which will be from 0 to 255): brightness = Serial.parseInt(); Serial.print("Command received : "); Serial.println(brightness); // set the brightness of the LED: analogWrite(vcntPin, brightness); }}