Choose One Project

Code upload does not work so I posted the code below:

int IRPin = 0; // the analog pin that the sensor is on
int IR = 0; // the value returned from the analog sensor
const int laser = 13;
int laserSTATE = LOW;

void setup() {
Serial.begin(9600);
}

void loop()
{
IR = analogRead(IRPin); // read the analog input (value between 0 and 1023)
Serial.println(IR);
if (IR >0 ) {
if (laserSTATE == LOW)
laserSTATE = HIGH;
else
laserSTATE = LOW;
}
else {
laserSTATE = LOW;
}
digitalWrite(laser, laserSTATE);
delay(200);
}

Advertisements

~ by Gates Winkler on April 4, 2010.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: