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

View File

@ -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() {

View File

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

View File

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

View File

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

View File

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

View File

@ -51,7 +51,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:

View File

@ -53,7 +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:

View File

@ -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");
} }
} }

View File

@ -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.
*/ */

View File

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

View File

@ -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");
} }
} }

View File

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

View File

@ -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);
}