Friday, October 9, 2009

Adding Max to the equation...


Using variables

  • Makes our code more human readable
  • Necessary for storing a value
  • A variable is a way of naming and storing a value for later use by the program, such as data from an analog pin
  • Variables must be declared before use
Just started with some recap on the use of variables and the theory.

Also discussed the notion of the pull-up resistor built into the Arduino pins and the obvious difference from the pull-down resistor. Looks a little something like the diagram below:

As stated in the diagram code is used to open the switch. The full code is below with the line to open the switch in bold.

void setup()
pinMode(3, INPUT);
digitalWrite(3, HIGH);

void loop()
int digiinput = digitalRead(3);

Got into Arduino Serail for the first time today (Tuesday) also. Was interesting, and simple what it boils down to is:

  • allows Arduino to talk to the computer
Programs to read Arduino Serail include:

  1. zterm
  2. hyperterminal
  3. cornflake (apparantly the best one)
New function for use with Serial:
Serial.print(1, BYTE)

No comments:

Post a Comment