mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-17 06:52:18 +01:00
Merge branch 'master' of github.com:arduino/Arduino into LUFA_bootloader
This commit is contained in:
commit
2c5a86e336
@ -26,6 +26,8 @@ package processing.app;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.datatransfer.*;
|
||||||
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,6 +70,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
JButton okButton;
|
JButton okButton;
|
||||||
JTextField editField;
|
JTextField editField;
|
||||||
JProgressBar progressBar;
|
JProgressBar progressBar;
|
||||||
|
JButton copyErrorButton;
|
||||||
|
|
||||||
//Thread promptThread;
|
//Thread promptThread;
|
||||||
int response;
|
int response;
|
||||||
@ -108,6 +111,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
public void notice(String message) {
|
public void notice(String message) {
|
||||||
mode = NOTICE;
|
mode = NOTICE;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
copyErrorButton.setVisible(false);
|
||||||
//update();
|
//update();
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
@ -120,6 +124,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
public void error(String message) {
|
public void error(String message) {
|
||||||
mode = ERR;
|
mode = ERR;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
copyErrorButton.setVisible(true);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +182,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
this.message = message;
|
this.message = message;
|
||||||
progressBar.setIndeterminate(false);
|
progressBar.setIndeterminate(false);
|
||||||
progressBar.setVisible(true);
|
progressBar.setVisible(true);
|
||||||
|
copyErrorButton.setVisible(false);
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
@ -189,6 +195,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
progressBar.setIndeterminate(true);
|
progressBar.setIndeterminate(true);
|
||||||
progressBar.setValue(50);
|
progressBar.setValue(50);
|
||||||
progressBar.setVisible(true);
|
progressBar.setVisible(true);
|
||||||
|
copyErrorButton.setVisible(false);
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
@ -207,6 +214,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
if (Preferences.getBoolean("editor.beep.compile")) {
|
if (Preferences.getBoolean("editor.beep.compile")) {
|
||||||
Toolkit.getDefaultToolkit().beep();
|
Toolkit.getDefaultToolkit().beep();
|
||||||
}
|
}
|
||||||
|
if (progressBar == null) return;
|
||||||
progressBar.setVisible(false);
|
progressBar.setVisible(false);
|
||||||
progressBar.setValue(0);
|
progressBar.setValue(0);
|
||||||
setCursor(null);
|
setCursor(null);
|
||||||
@ -216,6 +224,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
|
|
||||||
public void progressUpdate(int value)
|
public void progressUpdate(int value)
|
||||||
{
|
{
|
||||||
|
if (progressBar == null) return;
|
||||||
progressBar.setValue(value);
|
progressBar.setValue(value);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
@ -438,6 +447,29 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
add(progressBar);
|
add(progressBar);
|
||||||
progressBar.setVisible(false);
|
progressBar.setVisible(false);
|
||||||
|
|
||||||
|
copyErrorButton = new JButton(_("Copy To Clipboard"));
|
||||||
|
add(copyErrorButton);
|
||||||
|
//copyErrorButton.setVisible(true);
|
||||||
|
copyErrorButton.setVisible(false);
|
||||||
|
System.out.println("create copyErrorButton");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,6 +502,10 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
|
|||||||
editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop,
|
editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop,
|
||||||
editWidth, editHeight);
|
editWidth, editHeight);
|
||||||
progressBar.setBounds(noLeft, 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1187,6 +1187,16 @@ public class JEditTextArea extends JComponent
|
|||||||
selectionEndLine = newEndLine;
|
selectionEndLine = newEndLine;
|
||||||
biasLeft = newBias;
|
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();
|
fireCaretEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1649,7 +1659,11 @@ public class JEditTextArea extends JComponent
|
|||||||
for(int i = 0; i < repeatCount; i++)
|
for(int i = 0; i < repeatCount; i++)
|
||||||
buf.append(selection);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2206,6 +2220,25 @@ public class JEditTextArea extends JComponent
|
|||||||
return;
|
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 line = yToLine(evt.getY());
|
||||||
int offset = xToOffset(line,evt.getX());
|
int offset = xToOffset(line,evt.getX());
|
||||||
int dot = getLineStartOffset(line) + offset;
|
int dot = getLineStartOffset(line) + offset;
|
||||||
|
@ -108,6 +108,8 @@ public class DiscourseFormat {
|
|||||||
// i don't care about ownership
|
// i don't care about ownership
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Clipboard unixclipboard = Toolkit.getDefaultToolkit().getSystemSelection();
|
||||||
|
if (unixclipboard != null) unixclipboard.setContents(formatted, null);
|
||||||
|
|
||||||
editor.statusNotice("Code formatted for " +
|
editor.statusNotice("Code formatted for " +
|
||||||
(html ? "HTML" : "the Arduino forum ") +
|
(html ? "HTML" : "the Arduino forum ") +
|
||||||
|
@ -19,16 +19,18 @@
|
|||||||
by David A. Mellis
|
by David A. Mellis
|
||||||
modified 30 Aug 2011
|
modified 30 Aug 2011
|
||||||
by Limor Fried
|
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
|
http://www.arduino.cc/en/Tutorial/Debounce
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// constants won't change. They're used here to
|
// constants won't change. They're used here to
|
||||||
// set pin numbers:
|
// set pin numbers:
|
||||||
const int buttonPin = 2; // the number of the pushbutton pin
|
const int buttonPin = 2; // the number of the pushbutton pin
|
||||||
const int ledPin = 13; // the number of the LED pin
|
const int ledPin = 13; // the number of the LED pin
|
||||||
|
|
||||||
// Variables will change:
|
// Variables will change:
|
||||||
int ledState = HIGH; // the current state of the output pin
|
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() {
|
void setup() {
|
||||||
pinMode(buttonPin, INPUT);
|
pinMode(buttonPin, INPUT);
|
||||||
pinMode(ledPin, OUTPUT);
|
pinMode(ledPin, OUTPUT);
|
||||||
|
|
||||||
|
// set initial LED state
|
||||||
|
digitalWrite(ledPin, ledState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
@ -62,11 +67,20 @@ void loop() {
|
|||||||
if ((millis() - lastDebounceTime) > debounceDelay) {
|
if ((millis() - lastDebounceTime) > debounceDelay) {
|
||||||
// whatever the reading is at, it's been there for longer
|
// whatever the reading is at, it's been there for longer
|
||||||
// than the debounce delay, so take it as the actual current state:
|
// 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:
|
// set the LED:
|
||||||
digitalWrite(ledPin, buttonState);
|
digitalWrite(ledPin, ledState);
|
||||||
|
|
||||||
// save the reading. Next time through the loop,
|
// save the reading. Next time through the loop,
|
||||||
// it'll be the lastButtonState:
|
// it'll be the lastButtonState:
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
http://www.arduino.cc/en/Tutorial/KeyboardButton
|
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 previousButtonState = HIGH; // for checking the state of a pushButton
|
||||||
int counter = 0; // button push counter
|
int counter = 0; // button push counter
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
// The IP address will be dependent on your local network:
|
// The IP address will be dependent on your local network:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
||||||
IPAddress ip(192,168,1, 177);
|
IPAddress ip(192,168,1,177);
|
||||||
|
|
||||||
// Initialize the Ethernet server library
|
// Initialize the Ethernet server library
|
||||||
// with the IP address and port you want to use
|
// with the IP address and port you want to use
|
||||||
@ -63,12 +63,11 @@ void loop() {
|
|||||||
// send a standard http response header
|
// send a standard http response header
|
||||||
client.println("HTTP/1.1 200 OK");
|
client.println("HTTP/1.1 200 OK");
|
||||||
client.println("Content-Type: text/html");
|
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("<!DOCTYPE HTML>");
|
client.println("<!DOCTYPE HTML>");
|
||||||
client.println("<html>");
|
client.println("<html>");
|
||||||
// add a meta refresh tag, so the browser pulls again every 5 seconds:
|
|
||||||
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
|
|
||||||
// output the value of each analog input pin
|
// output the value of each analog input pin
|
||||||
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
|
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
|
||||||
int sensorReading = analogRead(analogChannel);
|
int sensorReading = analogRead(analogChannel);
|
||||||
|
@ -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:
|
// take the SS pin low to select the chip:
|
||||||
digitalWrite(slaveSelectPin,LOW);
|
digitalWrite(slaveSelectPin,LOW);
|
||||||
// send in the address and value via SPI:
|
// send in the address and value via SPI:
|
||||||
@ -68,4 +68,4 @@ int digitalPotWrite(int address, int value) {
|
|||||||
SPI.transfer(value);
|
SPI.transfer(value);
|
||||||
// take the SS pin high to de-select the chip:
|
// take the SS pin high to de-select the chip:
|
||||||
digitalWrite(slaveSelectPin,HIGH);
|
digitalWrite(slaveSelectPin,HIGH);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
|
|
||||||
char ssid[] = "yourNetwork"; // your network SSID (name)
|
char ssid[] = "yourNetwork"; // your network SSID (name)
|
||||||
char pass[] = "secretPassword"; // your network password
|
char pass[] = "secretPassword"; // your network password
|
||||||
int keyIndex = 0; // your network key Index number (needed only for WEP)
|
int keyIndex = 0; // your network key Index number (needed only for WEP)
|
||||||
|
|
||||||
@ -78,12 +78,11 @@ void loop() {
|
|||||||
// send a standard http response header
|
// send a standard http response header
|
||||||
client.println("HTTP/1.1 200 OK");
|
client.println("HTTP/1.1 200 OK");
|
||||||
client.println("Content-Type: text/html");
|
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("<!DOCTYPE HTML>");
|
client.println("<!DOCTYPE HTML>");
|
||||||
client.println("<html>");
|
client.println("<html>");
|
||||||
// add a meta refresh tag, so the browser pulls again every 5 seconds:
|
|
||||||
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
|
|
||||||
// output the value of each analog input pin
|
// output the value of each analog input pin
|
||||||
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
|
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
|
||||||
int sensorReading = analogRead(analogChannel);
|
int sensorReading = analogRead(analogChannel);
|
||||||
@ -108,9 +107,10 @@ void loop() {
|
|||||||
}
|
}
|
||||||
// give the web browser time to receive the data
|
// give the web browser time to receive the data
|
||||||
delay(1);
|
delay(1);
|
||||||
// close the connection:
|
|
||||||
client.stop();
|
// close the connection:
|
||||||
Serial.println("client disonnected");
|
client.stop();
|
||||||
|
Serial.println("client disonnected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user