1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Added core String library examples

This commit is contained in:
Tom Igoe
2010-07-27 19:03:52 +00:00
parent 4e33e6cb9f
commit bc2c88789f
6 changed files with 409 additions and 0 deletions

View File

@ -0,0 +1,73 @@
/*
Adding Strings together
Examples of how to add strings together
You can also add several different data types to string, as shown here:
The circuit: No external hardware needed.
created 27 July 2010
by Tom Igoe
This example code is in the public domain.
*/
// declare three strings:
String stringOne, stringTwo, stringThree;
void setup() {
Serial.begin(9600);
stringOne = String("stringThree = ");
stringTwo = String("this string");
stringThree = String ();
Serial.println("\n\nAdding strings together (concatenation):");
}
void loop() {
// adding a constant integer to a string:
stringThree = stringOne + 123;
Serial.println(stringThree); // prints "You added 123"
// adding a constant long interger to a string:
stringThree = stringOne + 123456789;
Serial.println(stringThree); // prints " You added 123456789"
// adding a constant character to a string:
stringThree = stringOne + 'A';
Serial.println(stringThree); // prints "You added A"
// adding a constant string to a string:
stringThree = stringOne + "abc";
Serial.println(stringThree); // prints "You added abc"
stringThree = stringOne + stringTwo;
Serial.println(stringThree); // prints "You added this string"
// adding a variable integer to a string:
int sensorValue = analogRead(0);
stringOne = "Sensor value: ";
stringThree = stringOne + sensorValue;
Serial.println(stringThree); // prints "Sensor Value: 401" or whatever value analogRead(0) has
// adding a variable long integer to a string:
long currentTime = millis();
stringOne="millis() value: ";
stringThree = stringOne + millis();
Serial.println(stringThree); // prints "The millis: 345345" or whatever value currentTime has
// do nothing while true:
while(true);
}

View File

@ -0,0 +1,41 @@
Arduino is an open-source physical computing platform based on a simple i/o
board and a development environment that implements the Processing/Wiring
language. Arduino can be used to develop stand-alone interactive objects or
can be connected to software on your computer (e.g. Flash, Processing, MaxMSP).
The boards can be assembled by hand or purchased preassembled; the open-source
IDE can be downloaded for free.
For more information, see the website at: http://www.arduino.cc/
or the forums at: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl
To report a bug or a make a suggestions, go to:
[hardware] http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=hwbugs
[software] http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs
INSTALLATION
Detailed instructions are in reference/Guide_Windows.html and
reference/Guide_MacOSX.html. For Linux, see the Arduino playground:
http://www.arduino.cc/playground/Learning/Linux
If you are using a USB Arduino, you will need to install the drivers for the
FTDI chip on the board. These can be found in the drivers/ directory.
* On Windows, plug in the Arduino board and point the Windows Add Hardware
wizard to the drivers/FTDI USB Drivers sub-directory of the Arduino
application directory.
* On the Mac, install the FTDIUSBSerialDriver_10_4_10_5_10_6.mpkg package.
* On Linux, drivers are included in kernel versions 2.4.20 or greater.
CREDITS
Arduino is an open source project, supported by many.
The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe,
Gianluca Martino, and David A. Mellis.
Arduino uses the GNU avr-gcc toolchain, avrdude, avr-libc, and code from
Processing and Wiring.
Icon Design and Artwork created by Thomas Glaser (envis precisely).