First Ardiuno Project Mosfet Inverter

Hey everybody this is my first post and I just ordered my first arduino so I'm very anxious I to get started, this is my first code:

I decide to skip the traditional Blinking LED (though I want to integrate it in) and went for a mosfet inverter that operates at 60 Hz - it will only be a square wave but I'll develop it as I get more confident in programming.

I would appreciate any feedback on the code itself:

other than actually acting as a switching power supply; I also want a visual indication that is running so and LED out of pin 8 will be occurring (my main question is how to I get two loops Running together in order to generate a inverter with a blinking LED that will allow the Inverter not to be affected by time).

Also is there any good free ebooks to help progress my learning?

Thanks so much

Nick

h/* Inverter Full Bridge Rectifier - Square Wave Inteverter operating at 60 Hertz */

int POT = 4;//Postive waveform ON TOP MOSFET OF BRIDGE RECTIFIER
int POB = 5;//Positive waveform ON BOTTOM MOSFET OF BRIDGE RECTIFIER
int NOT = 6;//Negative Waveform ON TOP MOSFET OF BRIDGE RECTIFIER
int NOB = 7;//Negative Waveform ON BOTTOM MOSFET OF BRIDGE RECTIFIER
int LED = 8;//LED to indicate circuit is running

void setup(){
pinMode(POT, OUTPUT);//Enable POT AS AN OUTPUT
pinMode (POB, OUTPUT);//ENABLE POB AS AN OUTPUT
pinMode (NOT, OUTPUT);//ENABLE NOT AS AN OUTPUT
pinMode (NOB, OUTPUT);//ENABLE NOT AS AN OUTPUT
pinMode (LED, OUTPUT);//ENABLE LED AS AN OUTPUT
}

void loop(){
digitalWrite (LED,HIGH);//Displays Circuit is running
digitalWrite(POT & POB, HIGH); //ENABLE CURRENT PATH FOR POSITIVE WAVEFORM
delay(8.333333);//DELAY IS ESTABLISHED BY 1/(602)= 8.333333 mS
digitalWrite(POT & POB, LOW); //disable current path for positve waveform
digitalWrite(NOT & NOB, HIGH);// enable current path for negative waveform
delay(8.333333);////DELAY IS ESTABLISHED BY 1/(60
2)= 8.333333 mS
digitalWrite (NOT & NOB , LOW);// disable current path for negative waveform

The code will toggle pins on and off but I am not sure you will get 8.333333 mS accuracy in the toggles.

Thanks for looking over the code.

I am in complete agreance with you about the accuracy - but to be honest I'm curious, I'm going to meassure the accuarcy witht the scope after I uploaded the code. I want to see the limitations of programming; as I used to be about all through hole components but the results of programming (for both accurcacy and ease of use) are unargueable.

But is it possible to have two loops occuring at the same time? And does anyone know of any good free ebooks (please include the links).

Thanks again,

Nick

delay(8.333333); for sure won't work as delay uses an unsigned long as it's argument, not a floating point argument. You would have to use delayMicroseconds(8333); instead and even then delayMicroseconds has a built in (I believe I recall) 4 usec step size resolution.

Lefty

You need to look at blink without delay if you want to get more than one thing to happen at the same time.

Mark

@Nicksek, this seems to be very similar to your other thead on a very similar subject with the same mistakes.
Do you want me to merge them so people won't waste time answering stuff that has already been answered, or just lock this thread?

AWOL, sorry about flooding the content just a newbie and eager to get things running; if you want to merge them I would be greatful.
Thanks for the feedback

Nick