i just connected two 120v power receptacles into my arduino through 2 relays. i have also connected a piezo element to analog in 0. my idea is to have one receptacle come on at a time, alternating, each time the threshold for the sensor is achieved. i do not know c++ very well at all and any help writing this would b awesome!
i also want them to turn on for 500ms before turning back off, and i need the arduino to limit this so it does not get overloaded, as the piezo will often be at threshold level more frequently than every 500ms