diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java
index d811cedba..59fb09069 100644
--- a/app/src/processing/app/Base.java
+++ b/app/src/processing/app/Base.java
@@ -31,6 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
import javax.jmdns.ServiceEvent;
import javax.swing.*;
+import javax.swing.filechooser.FileNameExtensionFilter;
import org.apache.commons.logging.impl.LogFactoryImpl;
import org.apache.commons.logging.impl.NoOpLog;
@@ -42,7 +43,6 @@ import processing.app.helpers.FileUtils;
import processing.app.helpers.PreferencesMap;
import processing.app.helpers.filefilters.OnlyDirs;
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
-import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
import processing.app.packages.Library;
import processing.app.packages.LibraryList;
import processing.app.tools.ZipDeflater;
@@ -1112,7 +1112,8 @@ public class Base {
}
});
importMenu.add(addLibraryMenuItem);
-
+ importMenu.addSeparator();
+
// Split between user supplied libraries and IDE libraries
TargetPlatform targetPlatform = getTargetPlatform();
diff --git a/app/src/processing/app/EditorListener.java b/app/src/processing/app/EditorListener.java
index 334345e29..c2d2fe600 100644
--- a/app/src/processing/app/EditorListener.java
+++ b/app/src/processing/app/EditorListener.java
@@ -131,8 +131,7 @@ public class EditorListener {
// The char is not control code when CTRL key pressed? It should be a shortcut.
if (!Character.isISOControl(c)) {
- event.consume();
- return true;
+ return false;
}
}
diff --git a/app/src/processing/app/EditorStatus.java b/app/src/processing/app/EditorStatus.java
index b757b013b..18b2b4f7c 100644
--- a/app/src/processing/app/EditorStatus.java
+++ b/app/src/processing/app/EditorStatus.java
@@ -27,6 +27,9 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
+import java.awt.datatransfer.*;
+import static processing.app.I18n._;
+
/**
* Panel just below the editing area that contains status messages.
@@ -68,6 +71,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
JButton okButton;
JTextField editField;
JProgressBar progressBar;
+ JButton copyErrorButton;
//Thread promptThread;
int response;
@@ -109,6 +113,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void notice(String message) {
mode = NOTICE;
this.message = message;
+ copyErrorButton.setVisible(false);
//update();
repaint();
}
@@ -121,6 +126,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void error(String message) {
mode = ERR;
this.message = message;
+ copyErrorButton.setVisible(true);
repaint();
}
@@ -178,6 +184,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
this.message = message;
progressBar.setIndeterminate(false);
progressBar.setVisible(true);
+ copyErrorButton.setVisible(false);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
repaint();
}
@@ -190,6 +197,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
progressBar.setIndeterminate(true);
progressBar.setValue(50);
progressBar.setVisible(true);
+ copyErrorButton.setVisible(false);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
repaint();
}
@@ -208,6 +216,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
if (Preferences.getBoolean("editor.beep.compile")) {
Toolkit.getDefaultToolkit().beep();
}
+ if (progressBar == null) return;
progressBar.setVisible(false);
progressBar.setValue(0);
setCursor(null);
@@ -217,6 +226,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void progressUpdate(int value)
{
+ if (progressBar == null) return;
progressBar.setValue(value);
repaint();
}
@@ -442,6 +452,32 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
add(progressBar);
progressBar.setVisible(false);
+ copyErrorButton = new JButton(
+ "" + _("Copy error") + "
" + _("to clipboard") + "");
+ Font font = copyErrorButton.getFont();
+ font = new Font(font.getName(), font.getStyle(), (int) (font.getSize()*0.7));
+ copyErrorButton.setFont(font);
+ copyErrorButton.setHorizontalAlignment(JLabel.CENTER);
+ add(copyErrorButton);
+ copyErrorButton.setVisible(false);
+ copyErrorButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ String message="";
+ if ((Preferences.getBoolean("build.verbose")) == false) {
+ message = " " + _("This report would have more information with") + "\n";
+ message += " \"" + _("Show verbose output during compilation") + "\"\n";
+ message += " " + _("enabled in File > Preferences.") + "\n";
+ }
+ message += _("Arduino: ") + Base.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
+ message += _("Board: ") + "\"" + Base.getBoardPreferences().get("name") + "\"\n";
+ message += editor.console.consoleTextPane.getText().trim();
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ StringSelection data = new StringSelection(message);
+ clipboard.setContents(data, null);
+ Clipboard unixclipboard = Toolkit.getDefaultToolkit().getSystemSelection();
+ if (unixclipboard != null) unixclipboard.setContents(data, null);
+ }
+ });
}
}
@@ -474,6 +510,10 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop,
editWidth, editHeight);
progressBar.setBounds(noLeft, editTop, editWidth, editHeight);
+
+ Dimension copyErrorButtonSize = copyErrorButton.getPreferredSize();
+ copyErrorButton.setLocation(sizeW - copyErrorButtonSize.width - 5, top);
+ copyErrorButton.setSize(copyErrorButtonSize.width, Preferences.BUTTON_HEIGHT);
}
diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java
index 8a76a9d33..aa7e220e3 100644
--- a/app/src/processing/app/syntax/JEditTextArea.java
+++ b/app/src/processing/app/syntax/JEditTextArea.java
@@ -1191,6 +1191,16 @@ public class JEditTextArea extends JComponent
selectionEndLine = newEndLine;
biasLeft = newBias;
+ if (newStart != newEnd) {
+ Clipboard unixclipboard = getToolkit().getSystemSelection();
+ if (unixclipboard != null) {
+ String selection = getSelectedText();
+ if (selection != null) {
+ unixclipboard.setContents(new StringSelection(selection), null);
+ }
+ }
+ }
+
fireCaretEvent();
}
@@ -1653,7 +1663,11 @@ public class JEditTextArea extends JComponent
for(int i = 0; i < repeatCount; i++)
buf.append(selection);
- clipboard.setContents(new StringSelection(buf.toString()),null);
+ Transferable t = new StringSelection(buf.toString());
+ clipboard.setContents(t, null);
+
+ Clipboard unixclipboard = getToolkit().getSystemSelection();
+ if (unixclipboard != null) unixclipboard.setContents(t, null);
}
}
@@ -2210,6 +2224,25 @@ public class JEditTextArea extends JComponent
return;
}
+ // on Linux, middle button pastes selected text
+ if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) {
+ Clipboard unixclipboard = getToolkit().getSystemSelection();
+ if (unixclipboard != null) {
+ Transferable t = unixclipboard.getContents(null);
+ if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
+ try {
+ String s = (String)t.getTransferData(DataFlavor.stringFlavor);
+ s = s.replace('\u00A0', ' ');
+ if (editable) setSelectedText(s);
+ } catch (Exception e) {
+ System.err.println(e);
+ e.printStackTrace();
+ }
+ }
+ return;
+ }
+ }
+
int line = yToLine(evt.getY());
int offset = xToOffset(line,evt.getX());
int dot = getLineStartOffset(line) + offset;
diff --git a/app/src/processing/app/tools/DiscourseFormat.java b/app/src/processing/app/tools/DiscourseFormat.java
index 097d7ee2c..5494a9ca3 100644
--- a/app/src/processing/app/tools/DiscourseFormat.java
+++ b/app/src/processing/app/tools/DiscourseFormat.java
@@ -108,6 +108,8 @@ public class DiscourseFormat {
// i don't care about ownership
}
});
+ Clipboard unixclipboard = Toolkit.getDefaultToolkit().getSystemSelection();
+ if (unixclipboard != null) unixclipboard.setContents(formatted, null);
editor.statusNotice("Code formatted for " +
(html ? "HTML" : "the Arduino forum ") +
diff --git a/build/shared/examples/02.Digital/Debounce/Debounce.ino b/build/shared/examples/02.Digital/Debounce/Debounce.ino
index 89416b269..da3aa29d9 100644
--- a/build/shared/examples/02.Digital/Debounce/Debounce.ino
+++ b/build/shared/examples/02.Digital/Debounce/Debounce.ino
@@ -19,16 +19,18 @@
by David A. Mellis
modified 30 Aug 2011
by Limor Fried
+ modified 28 Dec 2012
+ by Mike Walters
-This example code is in the public domain.
+ This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Debounce
*/
// constants won't change. They're used here to
// set pin numbers:
-const int buttonPin = 2; // the number of the pushbutton pin
-const int ledPin = 13; // the number of the LED pin
+const int buttonPin = 2; // the number of the pushbutton pin
+const int ledPin = 13; // the number of the LED pin
// Variables will change:
int ledState = HIGH; // the current state of the output pin
@@ -43,6 +45,9 @@ long debounceDelay = 50; // the debounce time; increase if the output flicker
void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
+
+ // set initial LED state
+ digitalWrite(ledPin, ledState);
}
void loop() {
@@ -62,11 +67,20 @@ void loop() {
if ((millis() - lastDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
- buttonState = reading;
+
+ // if the button state has changed:
+ if (reading != buttonState) {
+ buttonState = reading;
+
+ // only toggle the LED if the new button state is HIGH
+ if (buttonState == HIGH) {
+ ledState = !ledState;
+ }
+ }
}
- // set the LED using the state of the button:
- digitalWrite(ledPin, buttonState);
+ // set the LED:
+ digitalWrite(ledPin, ledState);
// save the reading. Next time through the loop,
// it'll be the lastButtonState:
diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino b/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino
index 938776c9a..f84891352 100644
--- a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino
+++ b/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino
@@ -19,7 +19,7 @@
http://www.arduino.cc/en/Tutorial/KeyboardButton
*/
-const int buttonPin = 2; // input pin for pushbutton
+const int buttonPin = 4; // input pin for pushbutton
int previousButtonState = HIGH; // for checking the state of a pushButton
int counter = 0; // button push counter
diff --git a/build/shared/lib/arduino_icon.ico b/build/shared/lib/arduino_icon.ico
new file mode 100755
index 000000000..a9f3a7acb
Binary files /dev/null and b/build/shared/lib/arduino_icon.ico differ
diff --git a/build/shared/lib/keywords.txt b/build/shared/lib/keywords.txt
index 55eaeb7d5..bc49ab701 100644
--- a/build/shared/lib/keywords.txt
+++ b/build/shared/lib/keywords.txt
@@ -184,6 +184,8 @@ parseInt KEYWORD2
parseFloat KEYWORD2
readBytes KEYWORD2
readBytesUntil KEYWORD2
+readString KEYWORD2
+readStringUntil KEYWORD2
# USB-related keywords
diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt
index 0e2d2f830..7c712f7db 100644
--- a/build/shared/revisions.txt
+++ b/build/shared/revisions.txt
@@ -98,22 +98,32 @@ ARDUINO 1.5 BETA - 2012.10.22
* For more info refer to this press release:
http://arduino.cc/blog/2012/10/22/arduino-1-5-support-for-the-due-and-other-processors-easier-library-installation-simplified-board-menu-etc/
-ARDUINO 1.0.5 - 2013.03.29
+ARDUINO 1.0.5 - 2013.05.15
[core]
* [avr] malloc bug: backported avr-libc 1.8.0 implementation
* [avr] removed deprecated interrupt handlers causing compiler issues
with newer avr-gcc.
+* [avr] added c_str() method to String
+* [avr] Stream "_timeout" field and related methods are now protected
[libraries]
* Upgrades to WiFi library
+* Fixed a bunch of examples
[firmwares]
* Upgrades to WiFi firmwares
+[ide]
+
+* Backport from 1.5: install Library from .zip file or folder
+* Added button "Copy error to clipboard" (Paul Stoffregen)
+* Updated windows drivers
+* Added Windows installer
+
ARDUINO 1.0.4 - 2013.03.11
[core]
diff --git a/build/windows/dist/drivers/arduino.cat b/build/windows/dist/drivers/arduino.cat
index 45d2c2207..a90a9798e 100644
Binary files a/build/windows/dist/drivers/arduino.cat and b/build/windows/dist/drivers/arduino.cat differ
diff --git a/build/windows/dist/drivers/arduino.inf b/build/windows/dist/drivers/arduino.inf
index bf3dd8291..7b0453cb4 100644
--- a/build/windows/dist/drivers/arduino.inf
+++ b/build/windows/dist/drivers/arduino.inf
@@ -1,7 +1,7 @@
; Copyright 2012 Blacklabel Development, Inc.
[Strings]
-DriverPackageDisplayName="Arduino Boards"
+DriverPackageDisplayName="Arduino USB Driver"
ManufacturerName="Arduino LLC (www.arduino.cc)"
ServiceName="USB RS-232 Emulation Driver"
due.bossa.name="Bossa Program Port"
diff --git a/build/windows/dist/drivers/dpinst-amd64.exe b/build/windows/dist/drivers/dpinst-amd64.exe
new file mode 100755
index 000000000..0507e7388
Binary files /dev/null and b/build/windows/dist/drivers/dpinst-amd64.exe differ
diff --git a/build/windows/dist/drivers/dpinst-x86.exe b/build/windows/dist/drivers/dpinst-x86.exe
new file mode 100755
index 000000000..41a890d11
Binary files /dev/null and b/build/windows/dist/drivers/dpinst-x86.exe differ
diff --git a/hardware/arduino/avr/cores/arduino/Arduino.h b/hardware/arduino/avr/cores/arduino/Arduino.h
index 02c2a8f50..5596c1498 100644
--- a/hardware/arduino/avr/cores/arduino/Arduino.h
+++ b/hardware/arduino/avr/cores/arduino/Arduino.h
@@ -48,7 +48,7 @@ void yield(void);
#define EXTERNAL 1
#define INTERNAL 2
#else
-#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
+#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
#define INTERNAL1V1 2
#define INTERNAL2V56 3
#else
diff --git a/hardware/arduino/avr/cores/arduino/Stream.h b/hardware/arduino/avr/cores/arduino/Stream.h
index 58bbf752f..007b4bc66 100644
--- a/hardware/arduino/avr/cores/arduino/Stream.h
+++ b/hardware/arduino/avr/cores/arduino/Stream.h
@@ -37,7 +37,7 @@ readBytesBetween( pre_string, terminator, buffer, length)
class Stream : public Print
{
- private:
+ protected:
unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
unsigned long _startMillis; // used for timeout measurement
int timedRead(); // private method to read stream with timeout
diff --git a/hardware/arduino/avr/cores/arduino/wiring_analog.c b/hardware/arduino/avr/cores/arduino/wiring_analog.c
index 3f19c7f88..7ed0e4e1c 100644
--- a/hardware/arduino/avr/cores/arduino/wiring_analog.c
+++ b/hardware/arduino/avr/cores/arduino/wiring_analog.c
@@ -45,7 +45,7 @@ int analogRead(uint8_t pin)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(__AVR_ATmega32U4__)
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
-#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
+#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
#elif defined(analogPinToChannel) && (defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__))
pin = analogPinToChannel(pin);
diff --git a/hardware/arduino/avr/cores/arduino/wiring_private.h b/hardware/arduino/avr/cores/arduino/wiring_private.h
index f67826567..90dbf2cf4 100644
--- a/hardware/arduino/avr/cores/arduino/wiring_private.h
+++ b/hardware/arduino/avr/cores/arduino/wiring_private.h
@@ -54,7 +54,7 @@ extern "C"{
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define EXTERNAL_NUM_INTERRUPTS 8
-#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
+#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
#define EXTERNAL_NUM_INTERRUPTS 3
#elif defined(__AVR_ATmega32U4__)
#define EXTERNAL_NUM_INTERRUPTS 4
diff --git a/hardware/arduino/avr/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino b/hardware/arduino/avr/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino
deleted file mode 100644
index c14abf403..000000000
--- a/hardware/arduino/avr/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- DNS and DHCP-based Web client
-
- This sketch connects to a website (http://www.google.com)
- using an Arduino Wiznet Ethernet shield.
-
- Circuit:
- * Ethernet shield attached to pins 10, 11, 12, 13
-
- created 18 Dec 2009
- by David A. Mellis
- modified 9 Apr 2012
- by Tom Igoe, based on work by Adrian McEwen
-
- */
-
-#include
-#include
-
-// Enter a MAC address for your controller below.
-// Newer Ethernet shields have a MAC address printed on a sticker on the shield
-byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
-char serverName[] = "www.google.com";
-
-// Initialize the Ethernet client library
-// with the IP address and port of the server
-// that you want to connect to (port 80 is default for HTTP):
-EthernetClient client;
-
-void setup() {
- // Open serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
-
- // start the Ethernet connection:
- if (Ethernet.begin(mac) == 0) {
- Serial.println("Failed to configure Ethernet using DHCP");
- // no point in carrying on, so do nothing forevermore:
- while(true);
- }
- // give the Ethernet shield a second to initialize:
- delay(1000);
- Serial.println("connecting...");
-
- // if you get a connection, report back via serial:
-
- if (client.connect(serverName, 80)) {
- Serial.println("connected");
- // Make a HTTP request:
- client.println("GET /search?q=arduino HTTP/1.0");
- client.println();
- }
- else {
- // kf you didn't get a connection to the server:
- Serial.println("connection failed");
- }
-}
-
-void loop()
-{
- // if there are incoming bytes available
- // from the server, read them and print them:
- if (client.available()) {
- char c = client.read();
- Serial.print(c);
- }
-
- // if the server's disconnected, stop the client:
- if (!client.connected()) {
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
-
- // do nothing forevermore:
- while(true);
- }
-}
-
diff --git a/hardware/arduino/avr/libraries/Ethernet/examples/TwitterClient/TwitterClient.ino b/hardware/arduino/avr/libraries/Ethernet/examples/TwitterClient/TwitterClient.ino
index 3587d72d3..9fee1feab 100644
--- a/hardware/arduino/avr/libraries/Ethernet/examples/TwitterClient/TwitterClient.ino
+++ b/hardware/arduino/avr/libraries/Ethernet/examples/TwitterClient/TwitterClient.ino
@@ -127,6 +127,7 @@ void connectToServer() {
// make HTTP GET request to twitter:
client.println("GET /1/statuses/user_timeline.xml?screen_name=arduino&count=1 HTTP/1.1");
client.println("HOST: api.twitter.com");
+ client.println("Connection: close");
client.println();
}
// note the time of this connect attempt:
diff --git a/hardware/arduino/avr/libraries/Ethernet/examples/WebClient/WebClient.ino b/hardware/arduino/avr/libraries/Ethernet/examples/WebClient/WebClient.ino
index 5d5d7f20b..40523a4d9 100644
--- a/hardware/arduino/avr/libraries/Ethernet/examples/WebClient/WebClient.ino
+++ b/hardware/arduino/avr/libraries/Ethernet/examples/WebClient/WebClient.ino
@@ -8,8 +8,9 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
- modified 9 Apr 2012
by David A. Mellis
+ modified 9 Apr 2012
+ by Tom Igoe, based on work by Adrian McEwen
*/
@@ -18,8 +19,14 @@
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
-byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
-IPAddress server(173,194,33,104); // Google
+byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
+// if you don't want to use DNS (and reduce your sketch size)
+// use the numeric IP instead of the name for the server:
+//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
+char server[] = "www.google.com"; // name address for Google (using DNS)
+
+// Set the static IP address to use if the DHCP fails to assign
+IPAddress ip(192,168,0,177);
// Initialize the Ethernet client library
// with the IP address and port of the server
@@ -37,8 +44,8 @@ void setup() {
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
- for(;;)
- ;
+ // try to congifure using IP address instead of DHCP:
+ Ethernet.begin(mac, ip);
}
// give the Ethernet shield a second to initialize:
delay(1000);
@@ -48,7 +55,9 @@ void setup() {
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
- client.println("GET /search?q=arduino HTTP/1.0");
+ client.println("GET /search?q=arduino HTTP/1.1");
+ client.println("Host: www.google.com");
+ client.println("Connection: close");
client.println();
}
else {
@@ -73,8 +82,7 @@ void loop()
client.stop();
// do nothing forevermore:
- for(;;)
- ;
+ while(true);
}
}
diff --git a/hardware/arduino/avr/libraries/Ethernet/examples/WebServer/WebServer.ino b/hardware/arduino/avr/libraries/Ethernet/examples/WebServer/WebServer.ino
index 0573f059d..5e5d67afa 100644
--- a/hardware/arduino/avr/libraries/Ethernet/examples/WebServer/WebServer.ino
+++ b/hardware/arduino/avr/libraries/Ethernet/examples/WebServer/WebServer.ino
@@ -22,7 +22,7 @@
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
-IPAddress ip(192,168,1, 177);
+IPAddress ip(192,168,1,177);
// Initialize the Ethernet server library
// with the IP address and port you want to use
@@ -63,12 +63,11 @@ void loop() {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
- client.println("Connection: close");
+ client.println("Connection: close"); // the connection will be closed after completion of the response
+ client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("");
client.println("");
- // add a meta refresh tag, so the browser pulls again every 5 seconds:
- client.println("");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
diff --git a/hardware/arduino/avr/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino b/hardware/arduino/avr/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino
index 445aab59e..2885c9bba 100644
--- a/hardware/arduino/avr/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino
+++ b/hardware/arduino/avr/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino
@@ -126,7 +126,7 @@ void sendData(int thisData)
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
- client.print("Host: api.pachube.com\n");
+ client.println("Host: api.pachube.com");
client.print("X-ApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
@@ -139,7 +139,7 @@ void sendData(int thisData)
client.println(thisLength);
// last pieces of the HTTP PUT request:
- client.print("Content-Type: text/csv\n");
+ client.println("Content-Type: text/csv");
client.println("Connection: close");
client.println();
diff --git a/hardware/arduino/avr/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino b/hardware/arduino/avr/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino
index f28370e42..9f6ea531d 100644
--- a/hardware/arduino/avr/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino
+++ b/hardware/arduino/avr/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino
@@ -138,7 +138,7 @@ void sendData(String thisData)
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
- client.print("Host: api.pachube.com\n");
+ client.println("Host: api.pachube.com");
client.print("X-ApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
@@ -147,8 +147,8 @@ void sendData(String thisData)
client.println(thisData.length());
// last pieces of the HTTP PUT request
- client.print("Content-Type: text/csv\n");
- client.println("Connection: close\n");
+ client.println("Content-Type: text/csv");
+ client.println("Connection: close");
client.println();
// here's the actual content of the PUT request
diff --git a/hardware/arduino/avr/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino b/hardware/arduino/avr/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
index 8a9636792..e7eb27587 100644
--- a/hardware/arduino/avr/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
+++ b/hardware/arduino/avr/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
@@ -2,8 +2,8 @@
Web client
This sketch connects to a website through a GSM shield. Specifically,
- this example downloads the URL "http://arduino.cc/" and prints it
- to the Serial monitor.
+ this example downloads the URL "http://arduino.cc/asciilogo.txt" and
+ prints it to the Serial monitor.
Circuit:
* GSM shield attached to an Arduino
@@ -34,7 +34,7 @@ GSM gsmAccess;
// URL, path & port (for example: arduino.cc)
char server[] = "arduino.cc";
-char path[] = "/";
+char path[] = "/asciilogo.txt";
int port = 80; // port 80 is the default for HTTP
void setup()
@@ -48,13 +48,13 @@ void setup()
Serial.println("Starting Arduino web client.");
// connection state
boolean notConnected = true;
-
+
// After starting the modem with GSM.begin()
// attach the shield to the GPRS network with the APN, login and password
while(notConnected)
{
if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
+ (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
notConnected = false;
else
{
@@ -72,7 +72,10 @@ void setup()
// Make a HTTP request:
client.print("GET ");
client.print(path);
- client.println(" HTTP/1.0");
+ client.println(" HTTP/1.1");
+ client.print("Host: ");
+ client.println(server);
+ client.println("Connection: close");
client.println();
}
else
@@ -91,7 +94,7 @@ void loop()
char c = client.read();
Serial.print(c);
}
-
+
// if the server's disconnected, stop the client:
if (!client.available() && !client.connected())
{
diff --git a/hardware/arduino/avr/libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino b/hardware/arduino/avr/libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino
index ef97dae88..adf93a2c1 100644
--- a/hardware/arduino/avr/libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino
+++ b/hardware/arduino/avr/libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino
@@ -60,7 +60,7 @@ void loop() {
}
-int digitalPotWrite(int address, int value) {
+void digitalPotWrite(int address, int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin,LOW);
// send in the address and value via SPI:
@@ -68,4 +68,4 @@ int digitalPotWrite(int address, int value) {
SPI.transfer(value);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
-}
\ No newline at end of file
+}
diff --git a/hardware/arduino/avr/libraries/WiFi/examples/WifiChatServer/WifiChatServer.ino b/hardware/arduino/avr/libraries/WiFi/examples/WiFiChatServer/WiFiChatServer.ino
similarity index 100%
rename from hardware/arduino/avr/libraries/WiFi/examples/WifiChatServer/WifiChatServer.ino
rename to hardware/arduino/avr/libraries/WiFi/examples/WiFiChatServer/WiFiChatServer.ino
diff --git a/hardware/arduino/avr/libraries/WiFi/examples/WifiPachubeClient/WifiPachubeClient.ino b/hardware/arduino/avr/libraries/WiFi/examples/WiFiPachubeClient/WiFiPachubeClient.ino
similarity index 100%
rename from hardware/arduino/avr/libraries/WiFi/examples/WifiPachubeClient/WifiPachubeClient.ino
rename to hardware/arduino/avr/libraries/WiFi/examples/WiFiPachubeClient/WiFiPachubeClient.ino
diff --git a/hardware/arduino/avr/libraries/WiFi/examples/WifiPachubeClientString/WifiPachubeClientString.ino b/hardware/arduino/avr/libraries/WiFi/examples/WiFiPachubeClientString/WiFiPachubeClientString.ino
similarity index 100%
rename from hardware/arduino/avr/libraries/WiFi/examples/WifiPachubeClientString/WifiPachubeClientString.ino
rename to hardware/arduino/avr/libraries/WiFi/examples/WiFiPachubeClientString/WiFiPachubeClientString.ino
diff --git a/hardware/arduino/avr/libraries/WiFi/examples/WifiTwitterClient/WifiTwitterClient.ino b/hardware/arduino/avr/libraries/WiFi/examples/WiFiTwitterClient/WiFiTwitterClient.ino
similarity index 98%
rename from hardware/arduino/avr/libraries/WiFi/examples/WifiTwitterClient/WifiTwitterClient.ino
rename to hardware/arduino/avr/libraries/WiFi/examples/WiFiTwitterClient/WiFiTwitterClient.ino
index 3dc2c8d33..d500cfb9b 100644
--- a/hardware/arduino/avr/libraries/WiFi/examples/WifiTwitterClient/WifiTwitterClient.ino
+++ b/hardware/arduino/avr/libraries/WiFi/examples/WiFiTwitterClient/WiFiTwitterClient.ino
@@ -132,8 +132,8 @@ void connectToServer() {
Serial.println("making HTTP request...");
// make HTTP GET request to twitter:
client.println("GET /1/statuses/user_timeline.xml?screen_name=arduino HTTP/1.1");
- client.println("Host:api.twitter.com");
- client.println("Connection:close");
+ client.println("Host: api.twitter.com");
+ client.println("Connection: close");
client.println();
}
// note the time of this connect attempt:
diff --git a/hardware/arduino/avr/libraries/WiFi/examples/WifiUdpSendReceiveString/WifiUdpSendReceiveString.ino b/hardware/arduino/avr/libraries/WiFi/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino
similarity index 100%
rename from hardware/arduino/avr/libraries/WiFi/examples/WifiUdpSendReceiveString/WifiUdpSendReceiveString.ino
rename to hardware/arduino/avr/libraries/WiFi/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino
diff --git a/hardware/arduino/avr/libraries/WiFi/examples/WifiWebClient/WifiWebClient.ino b/hardware/arduino/avr/libraries/WiFi/examples/WiFiWebClient/WiFiWebClient.ino
similarity index 92%
rename from hardware/arduino/avr/libraries/WiFi/examples/WifiWebClient/WifiWebClient.ino
rename to hardware/arduino/avr/libraries/WiFi/examples/WiFiWebClient/WiFiWebClient.ino
index 17f44a3aa..310ec46aa 100644
--- a/hardware/arduino/avr/libraries/WiFi/examples/WifiWebClient/WifiWebClient.ino
+++ b/hardware/arduino/avr/libraries/WiFi/examples/WiFiWebClient/WiFiWebClient.ino
@@ -31,8 +31,8 @@ int keyIndex = 0; // your network key Index number (needed only for W
int status = WL_IDLE_STATUS;
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
-IPAddress server(173,194,73,105); // numeric IP for Google (no DNS)
-//char server[] = "www.google.com"; // name address for Google (using DNS)
+//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
+char server[] = "www.google.com"; // name address for Google (using DNS)
// Initialize the Ethernet client library
// with the IP address and port of the server
@@ -54,7 +54,7 @@ void setup() {
}
// attempt to connect to Wifi network:
- while ( status != WL_CONNECTED) {
+ while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
@@ -72,7 +72,7 @@ void setup() {
Serial.println("connected to server");
// Make a HTTP request:
client.println("GET /search?q=arduino HTTP/1.1");
- client.println("Host:www.google.com");
+ client.println("Host: www.google.com");
client.println("Connection: close");
client.println();
}
diff --git a/hardware/arduino/avr/libraries/WiFi/examples/WifiWebClientRepeating/WifiWebClientRepeating.ino b/hardware/arduino/avr/libraries/WiFi/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino
similarity index 100%
rename from hardware/arduino/avr/libraries/WiFi/examples/WifiWebClientRepeating/WifiWebClientRepeating.ino
rename to hardware/arduino/avr/libraries/WiFi/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino
diff --git a/hardware/arduino/avr/libraries/WiFi/examples/WifiWebServer/WifiWebServer.ino b/hardware/arduino/avr/libraries/WiFi/examples/WiFiWebServer/WiFiWebServer.ino
similarity index 90%
rename from hardware/arduino/avr/libraries/WiFi/examples/WifiWebServer/WifiWebServer.ino
rename to hardware/arduino/avr/libraries/WiFi/examples/WiFiWebServer/WiFiWebServer.ino
index 7d7a24713..de861e880 100644
--- a/hardware/arduino/avr/libraries/WiFi/examples/WifiWebServer/WifiWebServer.ino
+++ b/hardware/arduino/avr/libraries/WiFi/examples/WiFiWebServer/WiFiWebServer.ino
@@ -22,7 +22,7 @@
#include
-char ssid[] = "yourNetwork"; // your network SSID (name)
+char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)
@@ -78,12 +78,11 @@ void loop() {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
- client.println("Connection: close");
+ client.println("Connection: close"); // the connection will be closed after completion of the response
+ client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("");
client.println("");
- // add a meta refresh tag, so the browser pulls again every 5 seconds:
- client.println("");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
@@ -108,9 +107,10 @@ void loop() {
}
// give the web browser time to receive the data
delay(1);
- // close the connection:
- client.stop();
- Serial.println("client disonnected");
+
+ // close the connection:
+ client.stop();
+ Serial.println("client disonnected");
}
}
diff --git a/hardware/arduino/sam/cores/arduino/Stream.h b/hardware/arduino/sam/cores/arduino/Stream.h
index 58bbf752f..007b4bc66 100644
--- a/hardware/arduino/sam/cores/arduino/Stream.h
+++ b/hardware/arduino/sam/cores/arduino/Stream.h
@@ -37,7 +37,7 @@ readBytesBetween( pre_string, terminator, buffer, length)
class Stream : public Print
{
- private:
+ protected:
unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
unsigned long _startMillis; // used for timeout measurement
int timedRead(); // private method to read stream with timeout
diff --git a/hardware/arduino/sam/cores/arduino/WString.h b/hardware/arduino/sam/cores/arduino/WString.h
index 311a475eb..2b0647869 100644
--- a/hardware/arduino/sam/cores/arduino/WString.h
+++ b/hardware/arduino/sam/cores/arduino/WString.h
@@ -146,6 +146,7 @@ public:
void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const;
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
{getBytes((unsigned char *)buf, bufsize, index);}
+ const char * c_str() const { return buffer; }
// search
int indexOf( char ch ) const;