trouble with analog inputs


hi im trying find code  alow me blink led when arduino  recevies analog input exelerometer tips or code helpfull. thanks. got folowing snipit member ive been strugaling incorporate in full runable code. :-?




int analogval = analogread(somepin);
if(analogval > somerandomnumber)
{
  // random thing
}

i far expert, giving try anyways :p

code: [select]

int ledpin =  13;    // led connected digital pin 13

void setup() {                
 // initialize digital pin output:
 pinmode(ledpin, output);    
}


void loop() {
 int analogval = analogread(somepin);
 if(analogval > somerandomnumber) {
   digitalwrite(ledpin, high);   // set led on
   delay(1000);                  // wait second
   digitalwrite(ledpin, low);    // set led off
   delay(1000);                  // wait second
 }  
}



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > trouble with analog inputs


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums