help alternating power to outputs!!:)

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

You can add a delay(500); after finding that the sensor has exceeded the threshold and toggling the relays. The program will wait for 500 milliseconds, then.

great yeh i got it workin now thanks. just basically combined the example knock and blink sketches and tht seemed to work. us beginners learn to improvise quite well.