25.4.09

progress...

slow and painful, till i get my loan through and get my hands on more shinyness.

i've been working more on my little buzz buzz, which detects light and buzzes away happily, but doesn't want to detect light and then let that determine wether or not it buzzes. annoying. it seems pretty simple it my mind but all the scripts i've tried don't work, and i can't find anything online...

here's the basic one i've started out with...


//if there is light, vibe.

int pins[] = { 9, 10,}; // an array of pin numbers
int num_pins = 6; // the number of pins (i.e. the length of the array)
int ledPin = 13; // LED is connected to digital pin 13
int sensorPin = 0; // light sensor is connected to analog pin 0
int sensorValue; // variable to store the value coming from the sensor


void setup()
{
int i;

for (i = 0; i < num_pins; i++) // the array elements are numbered from 0 to num_pins - 1
pinMode(pins[i], OUTPUT); // set each pin as an output

pinMode(pins[i], OUTPUT);
pinMode(ledPin, OUTPUT); // sets the ledPin to be an output
Serial.begin(9600); //initialize the serial port
digitalWrite(ledPin, HIGH); // turn the LED on
}

void loop()
{

int i;

sensorValue = analogRead(sensorPin); // read the value from the sensor
Serial.println(sensorValue); // send that value to the computer


if (sensorValue == 'HIGH') {

digitalWrite(pins[i], HIGH);
}
else {
digitalWrite(pins[i], LOW);
}


}


there are several other variations that FAIL.

No comments: