1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-15 12:29:26 +01:00

Merge remote-tracking branch 'arduino/master' into ide-1.5.x

Conflicts:
	build/shared/examples/01.Basics/Blink/Blink.ino
	build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino
	build/shared/examples/10.StarterKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino
	hardware/arduino/cores/arduino/HardwareSerial.cpp
This commit is contained in:
Cristian Maglie 2014-05-23 21:04:47 +02:00
commit 5d92c1ba8e
5 changed files with 37 additions and 17 deletions

View File

@ -2,23 +2,28 @@
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://arduino.cc
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
*/
// 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:
// the setup function runs once when you press reset or power the board
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop routine runs over and over again forever:
// the loop function 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
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

View File

@ -13,13 +13,15 @@
a final key combination (CTRL-U).
Circuit:
* Arduino Leonardo, Micro or Due
* Arduino Leonardo, Micro, Due, LilyPad USB, or Yun
* wire to connect D2 to ground.
created 5 Mar 2012
modified 29 Mar 2012
by Tom Igoe
modified 3 May 2014
by Scott Fitzgerald
This example is in the public domain
http://www.arduino.cc/en/Tutorial/KeyboardReprogram
@ -56,6 +58,18 @@ void loop() {
// wait for new window to open:
delay(1000);
// versions of the Arduino IDE after 1.5 pre-populate
// new sketches with setup() and loop() functions
// let's clear the window before typing anything new
// select all
Keyboard.press(ctrlKey);
Keyboard.press('a');
delay(500);
Keyboard.releaseAll();
// delete the selected text
Keyboard.write(KEY_BACKSPACE);
delay(500);
// Type out "blink":
Keyboard.println("void setup() {");
Keyboard.println("pinMode(13, OUTPUT);");
@ -95,3 +109,4 @@ void loop() {

View File

@ -44,7 +44,7 @@ void loop() {
switchstate = digitalRead(2);
// if the button is not pressed
// blink the red LEDs
// turn on the green LED and off the red LEDs
if (switchstate == LOW) {
digitalWrite(3, HIGH); // turn the green LED on pin 3 on
digitalWrite(4, LOW); // turn the red LED on pin 4 off
@ -52,7 +52,7 @@ void loop() {
}
// this else is part of the above if() statement.
// if the switch is not LOW (the button is pressed)
// the code below will run
// turn off the green LED and blink alternatively the red LEDs
else {
digitalWrite(3, LOW); // turn the green LED on pin 3 off
digitalWrite(4, LOW); // turn the red LED on pin 4 off

View File

@ -152,7 +152,7 @@ void HardwareSerial::end()
int HardwareSerial::available(void)
{
return (unsigned int)(SERIAL_RX_BUFFER_SIZE + _rx_buffer_head - _rx_buffer_tail) % SERIAL_RX_BUFFER_SIZE;
return (int)(SERIAL_RX_BUFFER_SIZE + _rx_buffer_head - _rx_buffer_tail) % SERIAL_RX_BUFFER_SIZE;
}
int HardwareSerial::peek(void)

View File

@ -355,7 +355,7 @@ SoftwareSerial::~SoftwareSerial()
void SoftwareSerial::setTX(uint8_t tx)
{
pinMode(tx, OUTPUT);
digitalWrite(tx, HIGH);
digitalWrite(tx, _inverse_logic ? LOW : HIGH);
_transmitBitMask = digitalPinToBitMask(tx);
uint8_t port = digitalPinToPort(tx);
_transmitPortRegister = portOutputRegister(port);