Tuesday, 7 February 2012

Where am I so far?

I am working on to making the EMF radiation detector but I am finding it difficult to make the LED bar graph to work :S

However, I have managed to find a link that actually shows me how to light it up so I am still working on it. 
But I managed to make the programming work on the Arduino app > 


const int ledPin =  1;      // the number of the LED pin


int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {
  
  pinMode(ledPin, OUTPUT);      
}

void loop()
{

  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval) {
    
    previousMillis = currentMillis;   

    
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    digitalWrite(ledPin, ledState);
  }
}

No comments:

Post a Comment