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
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
- zterm
- hyperterminal
- cornflake (apparantly the best one)
Serial.print(1, BYTE)
No comments:
Post a Comment