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

review of typos a and small errors in some examples

This commit is contained in:
Fede85 2012-10-18 19:03:25 +02:00
parent b89ef099a9
commit a21c4e153f
17 changed files with 56 additions and 85 deletions
build/shared/examples/08.Strings
StringAppendOperator
StringLength
hardware/arduino
avr/libraries/Ethernet/examples
CosmClient
CosmClientString
WebClientRepeating
sam/libraries
Ethernet/examples
CosmClient
CosmClientString
DhcpChatServer
DnsWebClient
UDPSendReceiveString
UdpNtpClient
WebClient
WebClientRepeating
WebServer
SPI/examples/DueX_ATFlashSignatureCheck

@ -11,6 +11,7 @@
This example code is in the public domain. This example code is in the public domain.
*/ */
String stringOne, stringTwo; String stringOne, stringTwo;
void setup() { void setup() {

@ -11,6 +11,7 @@
This example code is in the public domain. This example code is in the public domain.
*/ */
String txtMsg = ""; // a string for incoming text String txtMsg = ""; // a string for incoming text
int lastStringLength = txtMsg.length(); // previous length of the String int lastStringLength = txtMsg.length(); // previous length of the String

@ -51,7 +51,9 @@ char server[] = "api.cosm.com"; // name address for cosm API
unsigned long lastConnectionTime = 0; // last time you connected to the server, 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 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 const unsigned long postingInterval = 10L*1000L; // delay between updates to cosm.com
// the "L" is needed to use long type numbers
void setup() { void setup() {
// start serial port: // start serial port:

@ -53,8 +53,8 @@ char server[] = "api.cosm.com"; // name address for Cosm API
unsigned long lastConnectionTime = 0; // last time you connected to the server, 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 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 const unsigned long postingInterval = 10L*1000L; // delay between updates to Cosm.com
// the "L" is needed to use long type numbers
void setup() { void setup() {
// start serial port: // start serial port:
Serial.begin(9600); Serial.begin(9600);

@ -41,7 +41,8 @@ char server[] = "www.arduino.cc";
unsigned long lastConnectionTime = 0; // last time you connected to the server, 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 boolean lastConnected = false; // state of the connection last time through the main loop
const unsigned long postingInterval = 60*1000; // delay between updates, in milliseconds const unsigned long postingInterval = 60L*1000L; // delay between updates, in milliseconds
// the "L" is needed to use long type numbers
void setup() { void setup() {
// start serial port: // start serial port:

@ -46,12 +46,13 @@ EthernetClient client;
// if you don't want to use DNS (and reduce your sketch size) // if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server: // 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 char server[] = "api.cosm.com"; // name address for cosm API
unsigned long lastConnectionTime = 0; // last time you connected to the server, 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 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 const unsigned long postingInterval = 10L*1000L; // delay between updates to cosm.com
// the "L" is needed to use long type numbers
void setup() { void setup() {
// start serial port: // start serial port:

@ -36,7 +36,7 @@
// assign a MAC address for the ethernet controller. // assign a MAC address for the ethernet controller.
// fill in your address here: // fill in your address here:
byte mac[] = { byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
// fill in an available IP address on your network here, // 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) // if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server: // 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 char server[] = "api.cosm.com"; // name address for Cosm API
unsigned long lastConnectionTime = 0; // last time you connected to the server, 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 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 const unsigned long postingInterval = 10L*1000L; // delay between updates to Cosm.com
// the "L" is needed to use long type numbers
void setup() { void setup() {
// start serial port: // start serial port:

@ -26,9 +26,9 @@
// gateway and subnet are optional: // gateway and subnet are optional:
byte mac[] = { byte mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 }; 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
IPAddress ip(192,168,1, 177); IPAddress ip(192,168,1,177);
IPAddress gateway(192,168,1, 1); IPAddress gateway(192,168,1,1);
IPAddress subnet(255, 255, 0, 0); IPAddress subnet(255,255,0,0);
// telnet defaults to port 23 // telnet defaults to port 23
EthernetServer server(23); EthernetServer server(23);

@ -46,7 +46,6 @@ void setup() {
Serial.println("connecting..."); 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)) { if (client.connect(serverName, 80)) {
Serial.println("connected"); Serial.println("connected");
// Make a HTTP request: // Make a HTTP request:
@ -54,7 +53,7 @@ void setup() {
client.println(); client.println();
} }
else { 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"); Serial.println("connection failed");
} }
} }

@ -1,5 +1,6 @@
/* /*
UDPSendReceive.pde: UDPSendReceive
This sketch receives UDP message strings, prints them to the serial port This sketch receives UDP message strings, prints them to the serial port
and sends an "acknowledge" string back to the sender and sends an "acknowledge" string back to the sender
@ -10,6 +11,7 @@
by Michael Margolis by Michael Margolis
This code is in the public domain. This code is in the public domain.
*/ */
@ -22,7 +24,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);
unsigned int localPort = 8888; // local port to listen on unsigned int localPort = 8888; // local port to listen on

@ -1,5 +1,4 @@
/* /*
Udp NTP Client Udp NTP Client
Get the time from a Network Time Protocol (NTP) time server Get the time from a Network Time Protocol (NTP) time server

@ -52,7 +52,7 @@ void setup() {
client.println(); client.println();
} }
else { 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"); Serial.println("connection failed");
} }
} }

@ -41,7 +41,8 @@ char server[] = "www.arduino.cc";
unsigned long lastConnectionTime = 0; // last time you connected to the server, 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 boolean lastConnected = false; // state of the connection last time through the main loop
const unsigned long postingInterval = 60*1000; // delay between updates, in milliseconds const unsigned long postingInterval = 60L*1000L; // delay between updates, in milliseconds
// the "L" is needed to use long type numbers
void setup() { void setup() {
// start serial port: // start serial port:

@ -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

@ -1,37 +0,0 @@
#include <SPI.h>
// 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);
}