From a21c4e153f02b24c2189c0dbb76e50480ca8bdc1 Mon Sep 17 00:00:00 2001 From: Fede85 Date: Thu, 18 Oct 2012 19:03:25 +0200 Subject: [PATCH] review of typos a and small errors in some examples --- .../StringAppendOperator.ino | 1 + .../08.Strings/StringLength/StringLength.ino | 1 + .../examples/CosmClient/CosmClient.ino | 8 ++-- .../CosmClientString/CosmClientString.ino | 8 ++-- .../WebClientRepeating/WebClientRepeating.ino | 7 ++-- .../examples/CosmClient/CosmClient.ino | 11 +++--- .../CosmClientString/CosmClientString.ino | 11 +++--- .../DhcpAddressPrinter/DhcpAddressPrinter.ino | 2 +- .../DhcpChatServer/DhcpChatServer.ino | 8 ++-- .../examples/DnsWebClient/DnsWebClient.ino | 9 ++--- .../examples/TelnetClient/TelnetClient.ino | 2 +- .../UDPSendReceiveString.ino | 14 ++++--- .../examples/UdpNtpClient/UdpNtpClient.ino | 7 ++-- .../Ethernet/examples/WebClient/WebClient.ino | 2 +- .../WebClientRepeating/WebClientRepeating.ino | 7 ++-- .../Ethernet/examples/WebServer/WebServer.ino | 6 +-- .../DueX_ATFlashSignatureCheck.ino | 37 ------------------- 17 files changed, 56 insertions(+), 85 deletions(-) delete mode 100644 hardware/arduino/sam/libraries/SPI/examples/DueX_ATFlashSignatureCheck/DueX_ATFlashSignatureCheck.ino diff --git a/build/shared/examples/08.Strings/StringAppendOperator/StringAppendOperator.ino b/build/shared/examples/08.Strings/StringAppendOperator/StringAppendOperator.ino index b7eb12230..1ef19f21b 100644 --- a/build/shared/examples/08.Strings/StringAppendOperator/StringAppendOperator.ino +++ b/build/shared/examples/08.Strings/StringAppendOperator/StringAppendOperator.ino @@ -11,6 +11,7 @@ This example code is in the public domain. */ + String stringOne, stringTwo; void setup() { diff --git a/build/shared/examples/08.Strings/StringLength/StringLength.ino b/build/shared/examples/08.Strings/StringLength/StringLength.ino index 0d73364e2..152169813 100644 --- a/build/shared/examples/08.Strings/StringLength/StringLength.ino +++ b/build/shared/examples/08.Strings/StringLength/StringLength.ino @@ -11,6 +11,7 @@ This example code is in the public domain. */ + String txtMsg = ""; // a string for incoming text int lastStringLength = txtMsg.length(); // previous length of the String diff --git a/hardware/arduino/avr/libraries/Ethernet/examples/CosmClient/CosmClient.ino b/hardware/arduino/avr/libraries/Ethernet/examples/CosmClient/CosmClient.ino index 22815afb8..ec742780f 100644 --- a/hardware/arduino/avr/libraries/Ethernet/examples/CosmClient/CosmClient.ino +++ b/hardware/arduino/avr/libraries/Ethernet/examples/CosmClient/CosmClient.ino @@ -49,9 +49,11 @@ EthernetClient client; //IPAddress server(216,52,233,121); // numeric IP for api.cosm.com char server[] = "api.cosm.com"; // name address for cosm API -unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds -boolean lastConnected = false; // state of the connection last time through the main loop -const unsigned long postingInterval = 10*1000; //delay between updates to cosm.com +unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds +boolean lastConnected = false; // state of the connection last time through the main loop +const unsigned long postingInterval = 10L*1000L; // delay between updates to cosm.com + // the "L" is needed to use long type numbers + void setup() { // start serial port: diff --git a/hardware/arduino/avr/libraries/Ethernet/examples/CosmClientString/CosmClientString.ino b/hardware/arduino/avr/libraries/Ethernet/examples/CosmClientString/CosmClientString.ino index 05b549b10..e61992467 100644 --- a/hardware/arduino/avr/libraries/Ethernet/examples/CosmClientString/CosmClientString.ino +++ b/hardware/arduino/avr/libraries/Ethernet/examples/CosmClientString/CosmClientString.ino @@ -51,10 +51,10 @@ EthernetClient client; //IPAddress server(216,52,233,121); // numeric IP for api.cosm.com char server[] = "api.cosm.com"; // name address for Cosm API -unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds -boolean lastConnected = false; // state of the connection last time through the main loop -const unsigned long postingInterval = 10*1000; //delay between updates to Cosm.com - +unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds +boolean lastConnected = false; // state of the connection last time through the main loop +const unsigned long postingInterval = 10L*1000L; // delay between updates to Cosm.com + // the "L" is needed to use long type numbers void setup() { // start serial port: Serial.begin(9600); diff --git a/hardware/arduino/avr/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino b/hardware/arduino/avr/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino index e0f06c439..650f74efd 100644 --- a/hardware/arduino/avr/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino +++ b/hardware/arduino/avr/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino @@ -39,9 +39,10 @@ EthernetClient client; char server[] = "www.arduino.cc"; -unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds -boolean lastConnected = false; // state of the connection last time through the main loop -const unsigned long postingInterval = 60*1000; // delay between updates, in milliseconds +unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds +boolean lastConnected = false; // state of the connection last time through the main loop +const unsigned long postingInterval = 60L*1000L; // delay between updates, in milliseconds + // the "L" is needed to use long type numbers void setup() { // start serial port: diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/CosmClient/CosmClient.ino b/hardware/arduino/sam/libraries/Ethernet/examples/CosmClient/CosmClient.ino index 22815afb8..bb21f6234 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/CosmClient/CosmClient.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/CosmClient/CosmClient.ino @@ -46,17 +46,18 @@ EthernetClient client; // 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(216,52,233,121); // numeric IP for api.cosm.com +// IPAddress server(216,52,233,121); // numeric IP for api.cosm.com char server[] = "api.cosm.com"; // name address for cosm API -unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds -boolean lastConnected = false; // state of the connection last time through the main loop -const unsigned long postingInterval = 10*1000; //delay between updates to cosm.com +unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds +boolean lastConnected = false; // state of the connection last time through the main loop +const unsigned long postingInterval = 10L*1000L; // delay between updates to cosm.com + // the "L" is needed to use long type numbers void setup() { // start serial port: Serial.begin(9600); - // start the Ethernet connection: + // start the Ethernet connection: if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP"); // DHCP failed, so use a fixed IP address: diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/CosmClientString/CosmClientString.ino b/hardware/arduino/sam/libraries/Ethernet/examples/CosmClientString/CosmClientString.ino index 05b549b10..87834d5b1 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/CosmClientString/CosmClientString.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/CosmClientString/CosmClientString.ino @@ -36,7 +36,7 @@ // assign a MAC address for the ethernet controller. // fill in your address here: - byte mac[] = { +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // fill in an available IP address on your network here, @@ -48,12 +48,13 @@ EthernetClient client; // 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(216,52,233,121); // numeric IP for api.cosm.com +// IPAddress server(216,52,233,121); // numeric IP for api.cosm.com char server[] = "api.cosm.com"; // name address for Cosm API -unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds -boolean lastConnected = false; // state of the connection last time through the main loop -const unsigned long postingInterval = 10*1000; //delay between updates to Cosm.com +unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds +boolean lastConnected = false; // state of the connection last time through the main loop +const unsigned long postingInterval = 10L*1000L; // delay between updates to Cosm.com + // the "L" is needed to use long type numbers void setup() { // start serial port: diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino b/hardware/arduino/sam/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino index 5eaaf24d1..6fa6b359b 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino @@ -28,7 +28,7 @@ byte mac[] = { EthernetClient client; void setup() { - // Open serial communications and wait for port to open: + // Open serial communications and wait for port to open: Serial.begin(9600); // this check is only needed on the Leonardo: while (!Serial) { diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino b/hardware/arduino/sam/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino index 09cbd4354..c5620688f 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino @@ -1,5 +1,5 @@ /* - DHCP Chat Server + DHCP Chat Server A simple server that distributes any incoming messages to all connected clients. To use telnet to your device's IP address and type. @@ -26,9 +26,9 @@ // gateway and subnet are optional: byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 }; -IPAddress ip(192,168,1, 177); -IPAddress gateway(192,168,1, 1); -IPAddress subnet(255, 255, 0, 0); +IPAddress ip(192,168,1,177); +IPAddress gateway(192,168,1,1); +IPAddress subnet(255,255,0,0); // telnet defaults to port 23 EthernetServer server(23); diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino b/hardware/arduino/sam/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino index c14abf403..9b802c81a 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino @@ -19,7 +19,7 @@ // 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 }; +byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 }; char serverName[] = "www.google.com"; // Initialize the Ethernet client library @@ -28,7 +28,7 @@ char serverName[] = "www.google.com"; EthernetClient client; void setup() { - // Open serial communications and wait for port to open: + // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only @@ -45,8 +45,7 @@ void setup() { delay(1000); Serial.println("connecting..."); - // if you get a connection, report back via serial: - + // if you get a connection, report back via serial: if (client.connect(serverName, 80)) { Serial.println("connected"); // Make a HTTP request: @@ -54,7 +53,7 @@ void setup() { client.println(); } else { - // kf you didn't get a connection to the server: + // if you didn't get a connection to the server: Serial.println("connection failed"); } } diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino b/hardware/arduino/sam/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino index 345712564..28eb271a8 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/TelnetClient/TelnetClient.ino @@ -39,7 +39,7 @@ EthernetClient client; void setup() { // start the Ethernet connection: Ethernet.begin(mac, ip); - // Open serial communications and wait for port to open: + // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino b/hardware/arduino/sam/libraries/Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino index 4d4045cac..03cf650d1 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/UDPSendReceiveString/UDPSendReceiveString.ino @@ -1,5 +1,6 @@ /* - UDPSendReceive.pde: + UDPSendReceive + This sketch receives UDP message strings, prints them to the serial port and sends an "acknowledge" string back to the sender @@ -10,24 +11,25 @@ by Michael Margolis This code is in the public domain. + */ -#include // needed for Arduino versions later than 0018 +#include // needed for Arduino versions later than 0018 #include -#include // UDP library from: bjoern@cs.stanford.edu 12/30/2008 +#include // UDP library from: bjoern@cs.stanford.edu 12/30/2008 // Enter a MAC address and IP address for your controller below. // 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); -unsigned int localPort = 8888; // local port to listen on +unsigned int localPort = 8888; // local port to listen on // buffers for receiving and sending data -char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet, +char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet, char ReplyBuffer[] = "acknowledged"; // a string to send back // An EthernetUDP instance to let us send and receive packets over UDP diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino b/hardware/arduino/sam/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino index 93ffe3991..66abe8221 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino @@ -1,6 +1,5 @@ /* - - Udp NTP Client + Udp NTP Client Get the time from a Network Time Protocol (NTP) time server Demonstrates use of UDP sendPacket and ReceivePacket @@ -38,7 +37,7 @@ EthernetUDP Udp; void setup() { - // Open serial communications and wait for port to open: + // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only @@ -59,7 +58,7 @@ void loop() { sendNTPpacket(timeServer); // send an NTP packet to a time server - // wait to see if a reply is available + // wait to see if a reply is available delay(1000); if ( Udp.parsePacket() ) { // We've received a packet, read the data from it diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/WebClient/WebClient.ino b/hardware/arduino/sam/libraries/Ethernet/examples/WebClient/WebClient.ino index 5d5d7f20b..80e7e1944 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/WebClient/WebClient.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/WebClient/WebClient.ino @@ -52,7 +52,7 @@ void setup() { client.println(); } else { - // kf you didn't get a connection to the server: + // if you didn't get a connection to the server: Serial.println("connection failed"); } } diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino b/hardware/arduino/sam/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino index e0f06c439..650f74efd 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino +++ b/hardware/arduino/sam/libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino @@ -39,9 +39,10 @@ EthernetClient client; char server[] = "www.arduino.cc"; -unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds -boolean lastConnected = false; // state of the connection last time through the main loop -const unsigned long postingInterval = 60*1000; // delay between updates, in milliseconds +unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds +boolean lastConnected = false; // state of the connection last time through the main loop +const unsigned long postingInterval = 60L*1000L; // delay between updates, in milliseconds + // the "L" is needed to use long type numbers void setup() { // start serial port: diff --git a/hardware/arduino/sam/libraries/Ethernet/examples/WebServer/WebServer.ino b/hardware/arduino/sam/libraries/Ethernet/examples/WebServer/WebServer.ino index ce8dbb1b0..37e08aa15 100644 --- a/hardware/arduino/sam/libraries/Ethernet/examples/WebServer/WebServer.ino +++ b/hardware/arduino/sam/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 @@ -30,7 +30,7 @@ IPAddress ip(192,168,1, 177); EthernetServer server(80); void setup() { - // Open serial communications and wait for port to open: + // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only @@ -67,7 +67,7 @@ void loop() { client.println(); client.println(""); client.println(""); - // add a meta refresh tag, so the browser pulls again every 5 seconds: + // 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++) { diff --git a/hardware/arduino/sam/libraries/SPI/examples/DueX_ATFlashSignatureCheck/DueX_ATFlashSignatureCheck.ino b/hardware/arduino/sam/libraries/SPI/examples/DueX_ATFlashSignatureCheck/DueX_ATFlashSignatureCheck.ino deleted file mode 100644 index 8291bec1e..000000000 --- a/hardware/arduino/sam/libraries/SPI/examples/DueX_ATFlashSignatureCheck/DueX_ATFlashSignatureCheck.ino +++ /dev/null @@ -1,37 +0,0 @@ - -#include - -// Flash memory is connected on SPI pin SS3 -#define FLASH PIN_SPI_SS3 - -void setup() { - Serial.begin(9600); - - // Start SPI with FLASH device - SPI.begin(FLASH); - // Half clock speed: we are too fast with 1 - SPI.setClockDivider(FLASH, 2); -} - -void loop() { - // Send "identify" command (9f) and receive response - // on the same SPI transaction. Parameter SPI_CONTINUE - // keeps the SS pin active. - Serial.println("Sending 'Identify' cmd to flash => 9F"); - SPI.transfer(FLASH, 0x9f, SPI_CONTINUE); - char a1 = SPI.transfer(FLASH, 0x00, SPI_CONTINUE); - char a2 = SPI.transfer(FLASH, 0x00, SPI_CONTINUE); - char a3 = SPI.transfer(FLASH, 0x00, SPI_CONTINUE); - char a4 = SPI.transfer(FLASH, 0x00, SPI_CONTINUE); - char a5 = SPI.transfer(FLASH, 0x00); - - // Print response over serial port - Serial.print("Received signature: "); - Serial.print(a1, HEX); - Serial.print(a2, HEX); - Serial.print(a3, HEX); - Serial.print(a4, HEX); - Serial.println(a5, HEX); - - delay(1000); -}