Thursday, 19 January 2012

A variable & LED set up

A variable is a store for numbers or words
Intriguer abbreviation 'Int' is a number, and you give the number a name e.g int val = 3
You state what kind of variable weather a number or word otherwise computer wont recognise it
Once the number is named if you want to change it in a code you only need to change it once because you have it name the computer knows what to change automatically - Easier life :)

Code to enter in arduino:

int analogPin = 0;  
                   
int val = 0;        

void setup()
{
  Serial.begin(9600);  
pinMode(11, OUTPUT);
}

void loop()
{
  val = analogRead(analogPin);
  analogWrite(11, val / 4);
  Serial.println(val);
}






My LED set up...
LED is bright with extreme light exposure
 when sensors covered the light dims as there is very little lighting exposed

2 comments:

  1. you know i didnt come in today, so i guess this is what we're learning today? :S lol

    ReplyDelete
    Replies
    1. Yh one of, this morning we also made a connected a control board to a circuit.

      Delete