forked from codebndr/arduino-library-files
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated examples and libraries for Arduino 1.0.5
- Loading branch information
Showing
486 changed files
with
44,156 additions
and
6,938 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
AnalogReadSerial | ||
Reads an analog input on pin 0, prints the result to the serial monitor. | ||
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground. | ||
This example code is in the public domain. | ||
*/ | ||
|
||
// the setup routine runs once when you press reset: | ||
void setup() { | ||
// initialize serial communication at 9600 bits per second: | ||
Serial.begin(9600); | ||
} | ||
|
||
// the loop routine runs over and over again forever: | ||
void loop() { | ||
// read the input on analog pin 0: | ||
int sensorValue = analogRead(A0); | ||
// print out the value you read: | ||
Serial.println(sensorValue); | ||
delay(1); // delay in between reads for stability | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Blink | ||
Turns on an LED on for one second, then off for one second, repeatedly. | ||
This example code is in the public domain. | ||
*/ | ||
|
||
// Pin 13 has an LED connected on most Arduino boards. | ||
// give it a name: | ||
int led = 13; | ||
|
||
// the setup routine runs once when you press reset: | ||
void setup() { | ||
// initialize the digital pin as an output. | ||
pinMode(led, OUTPUT); | ||
} | ||
|
||
// the loop routine runs over and over again forever: | ||
void loop() { | ||
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) | ||
delay(1000); // wait for a second | ||
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW | ||
delay(1000); // wait for a second | ||
} |
29 changes: 29 additions & 0 deletions
29
examples/01.Basics/DigitalReadSerial/DigitalReadSerial.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
DigitalReadSerial | ||
Reads a digital input on pin 2, prints the result to the serial monitor | ||
This example code is in the public domain. | ||
*/ | ||
|
||
// digital pin 2 has a pushbutton attached to it. Give it a name: | ||
int pushButton = 2; | ||
|
||
// the setup routine runs once when you press reset: | ||
void setup() { | ||
// initialize serial communication at 9600 bits per second: | ||
Serial.begin(9600); | ||
// make the pushbutton's pin an input: | ||
pinMode(pushButton, INPUT); | ||
} | ||
|
||
// the loop routine runs over and over again forever: | ||
void loop() { | ||
// read the input pin: | ||
int buttonState = digitalRead(pushButton); | ||
// print out the state of the button: | ||
Serial.println(buttonState); | ||
delay(1); // delay in between reads for stability | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
examples/01.Basics/ReadAnalogVoltage/ReadAnalogVoltage.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
ReadAnalogVoltage | ||
Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor. | ||
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground. | ||
This example code is in the public domain. | ||
*/ | ||
|
||
// the setup routine runs once when you press reset: | ||
void setup() { | ||
// initialize serial communication at 9600 bits per second: | ||
Serial.begin(9600); | ||
} | ||
|
||
// the loop routine runs over and over again forever: | ||
void loop() { | ||
// read the input on analog pin 0: | ||
int sensorValue = analogRead(A0); | ||
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): | ||
float voltage = sensorValue * (5.0 / 1023.0); | ||
// print out the value you read: | ||
Serial.println(voltage); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
examples/02.Digital/DigitalInputPullup/DigitalInputPullup.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
Input Pullup Serial | ||
This example demonstrates the use of pinMode(INPUT_PULLUP). It reads a | ||
digital input on pin 2 and prints the results to the serial monitor. | ||
The circuit: | ||
* Momentary switch attached from pin 2 to ground | ||
* Built-in LED on pin 13 | ||
Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal | ||
20K-ohm resistor is pulled to 5V. This configuration causes the input to | ||
read HIGH when the switch is open, and LOW when it is closed. | ||
created 14 March 2012 | ||
by Scott Fitzgerald | ||
http://www.arduino.cc/en/Tutorial/InputPullupSerial | ||
This example code is in the public domain | ||
*/ | ||
|
||
void setup(){ | ||
//start serial connection | ||
Serial.begin(9600); | ||
//configure pin2 as an input and enable the internal pull-up resistor | ||
pinMode(2, INPUT_PULLUP); | ||
pinMode(13, OUTPUT); | ||
|
||
} | ||
|
||
void loop(){ | ||
//read the pushbutton value into a variable | ||
int sensorVal = digitalRead(2); | ||
//print out the value of the pushbutton | ||
Serial.println(sensorVal); | ||
|
||
// Keep in mind the pullup means the pushbutton's | ||
// logic is inverted. It goes HIGH when it's open, | ||
// and LOW when it's pressed. Turn on pin 13 when the | ||
// button's pressed, and off when it's not: | ||
if (sensorVal == HIGH) { | ||
digitalWrite(13, LOW); | ||
} | ||
else { | ||
digitalWrite(13, HIGH); | ||
} | ||
} | ||
|
||
|
||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,9 @@ | |
* Analog sensor (potentiometer will do) attached to analog input 0 | ||
Created 22 April 2007 | ||
modified 30 Aug 2011 | ||
By David A. Mellis <[email protected]> | ||
modified 9 Apr 2012 | ||
by Tom Igoe | ||
http://www.arduino.cc/en/Tutorial/Smoothing | ||
This example code is in the public domain. | ||
|
@@ -61,7 +61,8 @@ void loop() { | |
// calculate the average: | ||
average = total / numReadings; | ||
// send it to the computer as ASCII digits | ||
Serial.println(average); | ||
Serial.println(average); | ||
delay(1); // delay in between reads for stability | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.