arduino-0022
parent
4f99742f03
commit
a9ad0e80a0
@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
Analog input, serial output
|
|
||||||
|
|
||||||
Reads an analog input pin, prints the results to the serial monitor.
|
|
||||||
|
|
||||||
The circuit:
|
|
||||||
|
|
||||||
* potentiometer connected to analog pin 0.
|
|
||||||
Center pin of the potentiometer goes to the analog pin.
|
|
||||||
side pins of the potentiometer go to +5V and ground
|
|
||||||
|
|
||||||
created over and over again
|
|
||||||
by Tom Igoe and everyone who's ever used Arduino
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
// read the analog input into a variable:
|
|
||||||
int analogValue = analogRead(0);
|
|
||||||
// print the result:
|
|
||||||
Serial.println(analogValue);
|
|
||||||
// wait 10 milliseconds for the analog-to-digital converter
|
|
||||||
// to settle after the last reading:
|
|
||||||
delay(10);
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
Blink
|
|
||||||
|
|
||||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
|
||||||
|
|
||||||
The circuit:
|
|
||||||
* LED connected from digital pin 13 to ground.
|
|
||||||
|
|
||||||
* Note: On most Arduino boards, there is already an LED on the board
|
|
||||||
connected to pin 13, so you don't need any extra components for this example.
|
|
||||||
|
|
||||||
|
|
||||||
Created 1 June 2005
|
|
||||||
By David Cuartielles
|
|
||||||
|
|
||||||
http://arduino.cc/en/Tutorial/Blink
|
|
||||||
|
|
||||||
based on an orginal by H. Barragan for the Wiring i/o board
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ledPin = 13; // LED connected to digital pin 13
|
|
||||||
|
|
||||||
// The setup() method runs once, when the sketch starts
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
// initialize the digital pin as an output:
|
|
||||||
pinMode(ledPin, OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the loop() method runs over and over again,
|
|
||||||
// as long as the Arduino has power
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
digitalWrite(ledPin, HIGH); // set the LED on
|
|
||||||
delay(1000); // wait for a second
|
|
||||||
digitalWrite(ledPin, LOW); // set the LED off
|
|
||||||
delay(1000); // wait for a second
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
int sensorValue = analogRead(0);
|
|
||||||
Serial.println(sensorValue, DEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
void setup() {
|
|
||||||
pinMode(6, OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
int sensorValue = analogRead(2);
|
|
||||||
int ledFadeValue = map(sensorValue, 0, 1023, 0, 255);
|
|
||||||
analogWrite(6, ledFadeValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
void setup() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
|
|
||||||
void setup() {
|
|
||||||
pinMode(13, OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
int switchValue = digitalRead(2);
|
|
||||||
digitalWrite(13, switchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
void setup() {
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
Serial.println("Hello World!");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#ifndef WProgram_h
|
|
||||||
#define WProgram_h
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
|
|
||||||
#include "wiring.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#include "HardwareSerial.h"
|
|
||||||
|
|
||||||
uint16_t makeWord(uint16_t w);
|
|
||||||
uint16_t makeWord(byte h, byte l);
|
|
||||||
|
|
||||||
#define word(...) makeWord(__VA_ARGS__)
|
|
||||||
|
|
||||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
|
||||||
|
|
||||||
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
|
|
||||||
void noTone(uint8_t _pin);
|
|
||||||
|
|
||||||
// WMath prototypes
|
|
||||||
long random(long);
|
|
||||||
long random(long, long);
|
|
||||||
void randomSeed(unsigned int);
|
|
||||||
long map(long, long, long, long, long);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,179 +0,0 @@
|
|||||||
/*
|
|
||||||
wiring_analog.c - analog input and output
|
|
||||||
Part of Arduino - http://www.arduino.cc/
|
|
||||||
|
|
||||||
Copyright (c) 2005-2006 David A. Mellis
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General
|
|
||||||
Public License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
||||||
Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
$Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "wiring_private.h"
|
|
||||||
#include "pins_arduino.h"
|
|
||||||
|
|
||||||
uint8_t analog_reference = DEFAULT;
|
|
||||||
|
|
||||||
void analogReference(uint8_t mode)
|
|
||||||
{
|
|
||||||
// can't actually set the register here because the default setting
|
|
||||||
// will connect AVCC and the AREF pin, which would cause a short if
|
|
||||||
// there's something connected to AREF.
|
|
||||||
analog_reference = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int analogRead(uint8_t pin)
|
|
||||||
{
|
|
||||||
uint8_t low, high;
|
|
||||||
|
|
||||||
// set the analog reference (high two bits of ADMUX) and select the
|
|
||||||
// channel (low 4 bits). this also sets ADLAR (left-adjust result)
|
|
||||||
// to 0 (the default).
|
|
||||||
ADMUX = (analog_reference << 6) | (pin & 0x07);
|
|
||||||
|
|
||||||
#if defined(__AVR_ATmega1280__)
|
|
||||||
// the MUX5 bit of ADCSRB selects whether we're reading from channels
|
|
||||||
// 0 to 7 (MUX5 low) or 8 to 15 (MUX5 high).
|
|
||||||
ADCSRB = (ADCSRB & ~(1 << MUX5)) | (((pin >> 3) & 0x01) << MUX5);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// without a delay, we seem to read from the wrong channel
|
|
||||||
//delay(1);
|
|
||||||
|
|
||||||
// start the conversion
|
|
||||||
sbi(ADCSRA, ADSC);
|
|
||||||
|
|
||||||
// ADSC is cleared when the conversion finishes
|
|
||||||
while (bit_is_set(ADCSRA, ADSC));
|
|
||||||
|
|
||||||
// we have to read ADCL first; doing so locks both ADCL
|
|
||||||
// and ADCH until ADCH is read. reading ADCL second would
|
|
||||||
// cause the results of each conversion to be discarded,
|
|
||||||
// as ADCL and ADCH would be locked when it completed.
|
|
||||||
low = ADCL;
|
|
||||||
high = ADCH;
|
|
||||||
|
|
||||||
// combine the two bytes
|
|
||||||
return (high << 8) | low;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Right now, PWM output only works on the pins with
|
|
||||||
// hardware support. These are defined in the appropriate
|
|
||||||
// pins_*.c file. For the rest of the pins, we default
|
|
||||||
// to digital output.
|
|
||||||
void analogWrite(uint8_t pin, int val)
|
|
||||||
{
|
|
||||||
// We need to make sure the PWM output is enabled for those pins
|
|
||||||
// that support it, as we turn it off when digitally reading or
|
|
||||||
// writing with them. Also, make sure the pin is in output mode
|
|
||||||
// for consistenty with Wiring, which doesn't require a pinMode
|
|
||||||
// call for the analog output pins.
|
|
||||||
pinMode(pin, OUTPUT);
|
|
||||||
|
|
||||||
if (digitalPinToTimer(pin) == TIMER1A) {
|
|
||||||
// connect pwm to pin on timer 1, channel A
|
|
||||||
sbi(TCCR1A, COM1A1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR1A = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER1B) {
|
|
||||||
// connect pwm to pin on timer 1, channel B
|
|
||||||
sbi(TCCR1A, COM1B1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR1B = val;
|
|
||||||
#if defined(__AVR_ATmega8__)
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER2) {
|
|
||||||
// connect pwm to pin on timer 2, channel B
|
|
||||||
sbi(TCCR2, COM21);
|
|
||||||
// set pwm duty
|
|
||||||
OCR2 = val;
|
|
||||||
#else
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER0A) {
|
|
||||||
if (val == 0) {
|
|
||||||
digitalWrite(pin, LOW);
|
|
||||||
} else {
|
|
||||||
// connect pwm to pin on timer 0, channel A
|
|
||||||
sbi(TCCR0A, COM0A1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR0A = val;
|
|
||||||
}
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER0B) {
|
|
||||||
if (val == 0) {
|
|
||||||
digitalWrite(pin, LOW);
|
|
||||||
} else {
|
|
||||||
// connect pwm to pin on timer 0, channel B
|
|
||||||
sbi(TCCR0A, COM0B1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR0B = val;
|
|
||||||
}
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER2A) {
|
|
||||||
// connect pwm to pin on timer 2, channel A
|
|
||||||
sbi(TCCR2A, COM2A1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR2A = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER2B) {
|
|
||||||
// connect pwm to pin on timer 2, channel B
|
|
||||||
sbi(TCCR2A, COM2B1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR2B = val;
|
|
||||||
#endif
|
|
||||||
#if defined(__AVR_ATmega1280__)
|
|
||||||
// XXX: need to handle other timers here
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER3A) {
|
|
||||||
// connect pwm to pin on timer 3, channel A
|
|
||||||
sbi(TCCR3A, COM3A1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR3A = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER3B) {
|
|
||||||
// connect pwm to pin on timer 3, channel B
|
|
||||||
sbi(TCCR3A, COM3B1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR3B = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER3C) {
|
|
||||||
// connect pwm to pin on timer 3, channel C
|
|
||||||
sbi(TCCR3A, COM3C1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR3C = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER4A) {
|
|
||||||
// connect pwm to pin on timer 4, channel A
|
|
||||||
sbi(TCCR4A, COM4A1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR4A = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER4B) {
|
|
||||||
// connect pwm to pin on timer 4, channel B
|
|
||||||
sbi(TCCR4A, COM4B1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR4B = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER4C) {
|
|
||||||
// connect pwm to pin on timer 4, channel C
|
|
||||||
sbi(TCCR4A, COM4C1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR4C = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER5A) {
|
|
||||||
// connect pwm to pin on timer 5, channel A
|
|
||||||
sbi(TCCR5A, COM5A1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR5A = val;
|
|
||||||
} else if (digitalPinToTimer(pin) == TIMER5B) {
|
|
||||||
// connect pwm to pin on timer 5, channel B
|
|
||||||
sbi(TCCR5A, COM5B1);
|
|
||||||
// set pwm duty
|
|
||||||
OCR5B = val;
|
|
||||||
#endif
|
|
||||||
} else if (val < 128)
|
|
||||||
digitalWrite(pin, LOW);
|
|
||||||
else
|
|
||||||
digitalWrite(pin, HIGH);
|
|
||||||
}
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Chat Server
|
|
||||||
*
|
|
||||||
* A simple server that distributes any incoming messages to all
|
|
||||||
* connected clients. To use telnet to 10.0.0.177 and type!
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
// network configuration. gateway and subnet are optional.
|
|
||||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|
||||||
byte ip[] = { 10, 0, 0, 177 };
|
|
||||||
byte gateway[] = { 10, 0, 0, 1 };
|
|
||||||
byte subnet[] = { 255, 255, 0, 0 };
|
|
||||||
|
|
||||||
// telnet defaults to port 23
|
|
||||||
Server server(23);
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// initialize the ethernet device
|
|
||||||
Ethernet.begin(mac, ip, gateway, subnet);
|
|
||||||
|
|
||||||
// start listening for clients
|
|
||||||
server.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
Client client = server.available();
|
|
||||||
if (client) {
|
|
||||||
server.write(client.read());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|
||||||
byte ip[] = { 10, 0, 0, 177 };
|
|
||||||
byte server[] = { 64, 233, 187, 99 }; // Google
|
|
||||||
|
|
||||||
Client client(server, 80);
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Ethernet.begin(mac, ip);
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
Serial.println("connecting...");
|
|
||||||
|
|
||||||
if (client.connect()) {
|
|
||||||
Serial.println("connected");
|
|
||||||
client.println("GET /search?q=arduino HTTP/1.0");
|
|
||||||
client.println();
|
|
||||||
} else {
|
|
||||||
Serial.println("connection failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
if (client.available()) {
|
|
||||||
char c = client.read();
|
|
||||||
Serial.print(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!client.connected()) {
|
|
||||||
Serial.println();
|
|
||||||
Serial.println("disconnecting.");
|
|
||||||
client.stop();
|
|
||||||
for(;;)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* Web Server
|
|
||||||
*
|
|
||||||
* A simple web server that shows the value of the analog input pins.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|
||||||
byte ip[] = { 10, 0, 0, 177 };
|
|
||||||
|
|
||||||
Server server(80);
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Ethernet.begin(mac, ip);
|
|
||||||
server.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
Client client = server.available();
|
|
||||||
if (client) {
|
|
||||||
// an http request ends with a blank line
|
|
||||||
boolean current_line_is_blank = true;
|
|
||||||
while (client.connected()) {
|
|
||||||
if (client.available()) {
|
|
||||||
char c = client.read();
|
|
||||||
// if we've gotten to the end of the line (received a newline
|
|
||||||
// character) and the line is blank, the http request has ended,
|
|
||||||
// so we can send a reply
|
|
||||||
if (c == '\n' && current_line_is_blank) {
|
|
||||||
// send a standard http response header
|
|
||||||
client.println("HTTP/1.1 200 OK");
|
|
||||||
client.println("Content-Type: text/html");
|
|
||||||
client.println();
|
|
||||||
|
|
||||||
// output the value of each analog input pin
|
|
||||||
for (int i = 0; i < 6; i++) {
|
|
||||||
client.print("analog input ");
|
|
||||||
client.print(i);
|
|
||||||
client.print(" is ");
|
|
||||||
client.print(analogRead(i));
|
|
||||||
client.println("<br />");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (c == '\n') {
|
|
||||||
// we're starting a new line
|
|
||||||
current_line_is_blank = true;
|
|
||||||
} else if (c != '\r') {
|
|
||||||
// we've gotten a character on the current line
|
|
||||||
current_line_is_blank = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// give the web browser time to receive the data
|
|
||||||
delay(1);
|
|
||||||
client.stop();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,558 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
@file socket.c
|
|
||||||
@brief setting chip register for socket
|
|
||||||
last update : 2008. Jan
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "w5100.h"
|
|
||||||
#include "socket.h"
|
|
||||||
|
|
||||||
static uint16 local_port;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This Socket function initialize the channel in perticular mode, and set the port and wait for W5100 done it.
|
|
||||||
@return 1 for sucess else 0.
|
|
||||||
*/
|
|
||||||
uint8 socket(
|
|
||||||
SOCKET s, /**< for socket number */
|
|
||||||
uint8 protocol, /**< for socket protocol */
|
|
||||||
uint16 port, /**< the source port for the socket */
|
|
||||||
uint8 flag /**< the option for the socket */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
uint8 ret;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("socket()\r\n");
|
|
||||||
#endif
|
|
||||||
if ((protocol == Sn_MR_TCP) || (protocol == Sn_MR_UDP) || (protocol == Sn_MR_IPRAW) || (protocol == Sn_MR_MACRAW) || (protocol == Sn_MR_PPPOE))
|
|
||||||
{
|
|
||||||
close(s);
|
|
||||||
IINCHIP_WRITE(Sn_MR(s),protocol | flag);
|
|
||||||
if (port != 0) {
|
|
||||||
IINCHIP_WRITE(Sn_PORT0(s),(uint8)((port & 0xff00) >> 8));
|
|
||||||
IINCHIP_WRITE((Sn_PORT0(s) + 1),(uint8)(port & 0x00ff));
|
|
||||||
} else {
|
|
||||||
local_port++; // if don't set the source port, set local_port number.
|
|
||||||
IINCHIP_WRITE(Sn_PORT0(s),(uint8)((local_port & 0xff00) >> 8));
|
|
||||||
IINCHIP_WRITE((Sn_PORT0(s) + 1),(uint8)(local_port & 0x00ff));
|
|
||||||
}
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_OPEN); // run sockinit Sn_CR
|
|
||||||
|
|
||||||
/* +20071122[chungs]:wait to process the command... */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
ret = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("Sn_SR = %.2x , Protocol = %.2x\r\n", IINCHIP_READ(Sn_SR(s)), IINCHIP_READ(Sn_MR(s)));
|
|
||||||
#endif
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This function close the socket and parameter is "s" which represent the socket number
|
|
||||||
*/
|
|
||||||
void close(SOCKET s)
|
|
||||||
{
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("close()\r\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_CLOSE);
|
|
||||||
|
|
||||||
/* +20071122[chungs]:wait to process the command... */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
|
|
||||||
/* +2008.01 [hwkim]: clear interrupt */
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
/* m2008.01 [bj] : all clear */
|
|
||||||
putISR(s, 0x00);
|
|
||||||
#else
|
|
||||||
/* m2008.01 [bj] : all clear */
|
|
||||||
IINCHIP_WRITE(Sn_IR(s), 0xFF);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This function established the connection for the channel in passive (server) mode. This function waits for the request from the peer.
|
|
||||||
@return 1 for success else 0.
|
|
||||||
*/
|
|
||||||
uint8 listen(
|
|
||||||
SOCKET s /**< the socket number */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
uint8 ret;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("listen()\r\n");
|
|
||||||
#endif
|
|
||||||
if (IINCHIP_READ(Sn_SR(s)) == SOCK_INIT)
|
|
||||||
{
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_LISTEN);
|
|
||||||
/* +20071122[chungs]:wait to process the command... */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
ret = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = 0;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("Fail[invalid ip,port]\r\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This function established the connection for the channel in Active (client) mode.
|
|
||||||
This function waits for the untill the connection is established.
|
|
||||||
|
|
||||||
@return 1 for success else 0.
|
|
||||||
*/
|
|
||||||
uint8 connect(SOCKET s, uint8 * addr, uint16 port)
|
|
||||||
{
|
|
||||||
uint8 ret;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("connect()\r\n");
|
|
||||||
#endif
|
|
||||||
if
|
|
||||||
(
|
|
||||||
((addr[0] == 0xFF) && (addr[1] == 0xFF) && (addr[2] == 0xFF) && (addr[3] == 0xFF)) ||
|
|
||||||
((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) ||
|
|
||||||
(port == 0x00)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ret = 0;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("Fail[invalid ip,port]\r\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = 1;
|
|
||||||
// set destination IP
|
|
||||||
IINCHIP_WRITE(Sn_DIPR0(s),addr[0]);
|
|
||||||
IINCHIP_WRITE((Sn_DIPR0(s) + 1),addr[1]);
|
|
||||||
IINCHIP_WRITE((Sn_DIPR0(s) + 2),addr[2]);
|
|
||||||
IINCHIP_WRITE((Sn_DIPR0(s) + 3),addr[3]);
|
|
||||||
IINCHIP_WRITE(Sn_DPORT0(s),(uint8)((port & 0xff00) >> 8));
|
|
||||||
IINCHIP_WRITE((Sn_DPORT0(s) + 1),(uint8)(port & 0x00ff));
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_CONNECT);
|
|
||||||
/* m2008.01 [bj] : wait for completion */
|
|
||||||
while ( IINCHIP_READ(Sn_CR(s)) ) ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This function used for disconnect the socket and parameter is "s" which represent the socket number
|
|
||||||
@return 1 for success else 0.
|
|
||||||
*/
|
|
||||||
void disconnect(SOCKET s)
|
|
||||||
{
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("disconnect()\r\n");
|
|
||||||
#endif
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_DISCON);
|
|
||||||
|
|
||||||
/* +20071122[chungs]:wait to process the command... */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This function used to send the data in TCP mode
|
|
||||||
@return 1 for success else 0.
|
|
||||||
*/
|
|
||||||
uint16 send(
|
|
||||||
SOCKET s, /**< the socket index */
|
|
||||||
const uint8 * buf, /**< a pointer to data */
|
|
||||||
uint16 len /**< the data size to be send */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
uint8 status=0;
|
|
||||||
uint16 ret=0;
|
|
||||||
uint16 freesize=0;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("send()\r\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (len > getIINCHIP_TxMAX(s)) ret = getIINCHIP_TxMAX(s); // check size not to exceed MAX size.
|
|
||||||
else ret = len;
|
|
||||||
|
|
||||||
// if freebuf is available, start.
|
|
||||||
do
|
|
||||||
{
|
|
||||||
freesize = getSn_TX_FSR(s);
|
|
||||||
status = IINCHIP_READ(Sn_SR(s));
|
|
||||||
if ((status != SOCK_ESTABLISHED) && (status != SOCK_CLOSE_WAIT))
|
|
||||||
{
|
|
||||||
ret = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("socket %d freesize(%d) empty or error\r\n", s, freesize);
|
|
||||||
#endif
|
|
||||||
} while (freesize < ret);
|
|
||||||
|
|
||||||
// copy data
|
|
||||||
send_data_processing(s, (uint8 *)buf, ret);
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_SEND);
|
|
||||||
|
|
||||||
/* +20071122[chungs]:wait to process the command... */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
|
|
||||||
/* +2008.01 bj */
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
while ( (getISR(s) & Sn_IR_SEND_OK) != Sn_IR_SEND_OK )
|
|
||||||
#else
|
|
||||||
while ( (IINCHIP_READ(Sn_IR(s)) & Sn_IR_SEND_OK) != Sn_IR_SEND_OK )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
/* m2008.01 [bj] : reduce code */
|
|
||||||
if ( IINCHIP_READ(Sn_SR(s)) == SOCK_CLOSED )
|
|
||||||
{
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("SOCK_CLOSED.\r\n");
|
|
||||||
#endif
|
|
||||||
close(s);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* +2008.01 bj */
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
putISR(s, getISR(s) & (~Sn_IR_SEND_OK));
|
|
||||||
#else
|
|
||||||
IINCHIP_WRITE(Sn_IR(s), Sn_IR_SEND_OK);
|
|
||||||
#endif
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This function is an application I/F function which is used to receive the data in TCP mode.
|
|
||||||
It continues to wait for data as much as the application wants to receive.
|
|
||||||
|
|
||||||
@return received data size for success else -1.
|
|
||||||
*/
|
|
||||||
uint16 recv(
|
|
||||||
SOCKET s, /**< socket index */
|
|
||||||
uint8 * buf, /**< a pointer to copy the data to be received */
|
|
||||||
uint16 len /**< the data size to be read */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
uint16 ret=0;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("recv()\r\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if ( len > 0 )
|
|
||||||
{
|
|
||||||
recv_data_processing(s, buf, len);
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_RECV);
|
|
||||||
|
|
||||||
/* +20071122[chungs]:wait to process the command... */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
ret = len;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This function is an application I/F function which is used to send the data for other then TCP mode.
|
|
||||||
Unlike TCP transmission, The peer's destination address and the port is needed.
|
|
||||||
|
|
||||||
@return This function return send data size for success else -1.
|
|
||||||
*/
|
|
||||||
uint16 sendto(
|
|
||||||
SOCKET s, /**< socket index */
|
|
||||||
const uint8 * buf, /**< a pointer to the data */
|
|
||||||
uint16 len, /**< the data size to send */
|
|
||||||
uint8 * addr, /**< the peer's Destination IP address */
|
|
||||||
uint16 port /**< the peer's destination port number */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// uint8 status=0;
|
|
||||||
// uint8 isr=0;
|
|
||||||
uint16 ret=0;
|
|
||||||
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("sendto()\r\n");
|
|
||||||
#endif
|
|
||||||
if (len > getIINCHIP_TxMAX(s)) ret = getIINCHIP_TxMAX(s); // check size not to exceed MAX size.
|
|
||||||
else ret = len;
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) ||
|
|
||||||
((port == 0x00)) ||(ret == 0)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
/* +2008.01 [bj] : added return value */
|
|
||||||
ret = 0;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("%d Fail[%.2x.%.2x.%.2x.%.2x, %.d, %d]\r\n",s, addr[0], addr[1], addr[2], addr[3] , port, len);
|
|
||||||
printf("Fail[invalid ip,port]\r\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IINCHIP_WRITE(Sn_DIPR0(s),addr[0]);
|
|
||||||
IINCHIP_WRITE((Sn_DIPR0(s) + 1),addr[1]);
|
|
||||||
IINCHIP_WRITE((Sn_DIPR0(s) + 2),addr[2]);
|
|
||||||
IINCHIP_WRITE((Sn_DIPR0(s) + 3),addr[3]);
|
|
||||||
IINCHIP_WRITE(Sn_DPORT0(s),(uint8)((port & 0xff00) >> 8));
|
|
||||||
IINCHIP_WRITE((Sn_DPORT0(s) + 1),(uint8)(port & 0x00ff));
|
|
||||||
|
|
||||||
// copy data
|
|
||||||
send_data_processing(s, (uint8 *)buf, ret);
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_SEND);
|
|
||||||
|
|
||||||
/* +20071122[chungs]:wait to process the command... */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
|
|
||||||
/* +2008.01 bj */
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
while ( (getISR(s) & Sn_IR_SEND_OK) != Sn_IR_SEND_OK )
|
|
||||||
#else
|
|
||||||
while ( (IINCHIP_READ(Sn_IR(s)) & Sn_IR_SEND_OK) != Sn_IR_SEND_OK )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
if (getISR(s) & Sn_IR_TIMEOUT)
|
|
||||||
#else
|
|
||||||
if (IINCHIP_READ(Sn_IR(s)) & Sn_IR_TIMEOUT)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("send fail.\r\n");
|
|
||||||
#endif
|
|
||||||
/* +2008.01 [bj]: clear interrupt */
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
putISR(s, getISR(s) & ~(Sn_IR_SEND_OK | Sn_IR_TIMEOUT)); /* clear SEND_OK & TIMEOUT */
|
|
||||||
#else
|
|
||||||
IINCHIP_WRITE(Sn_IR(s), (Sn_IR_SEND_OK | Sn_IR_TIMEOUT)); /* clear SEND_OK & TIMEOUT */
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* +2008.01 bj */
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
putISR(s, getISR(s) & (~Sn_IR_SEND_OK));
|
|
||||||
#else
|
|
||||||
IINCHIP_WRITE(Sn_IR(s), Sn_IR_SEND_OK);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief This function is an application I/F function which is used to receive the data in other then
|
|
||||||
TCP mode. This function is used to receive UDP, IP_RAW and MAC_RAW mode, and handle the header as well.
|
|
||||||
|
|
||||||
@return This function return received data size for success else -1.
|
|
||||||
*/
|
|
||||||
uint16 recvfrom(
|
|
||||||
SOCKET s, /**< the socket number */
|
|
||||||
uint8 * buf, /**< a pointer to copy the data to be received */
|
|
||||||
uint16 len, /**< the data size to read */
|
|
||||||
uint8 * addr, /**< a pointer to store the peer's IP address */
|
|
||||||
uint16 *port /**< a pointer to store the peer's port number. */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
uint8 head[8];
|
|
||||||
uint16 data_len=0;
|
|
||||||
uint16 ptr=0;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("recvfrom()\r\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( len > 0 )
|
|
||||||
{
|
|
||||||
ptr = IINCHIP_READ(Sn_RX_RD0(s));
|
|
||||||
ptr = ((ptr & 0x00ff) << 8) + IINCHIP_READ(Sn_RX_RD0(s) + 1);
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("ISR_RX: rd_ptr : %.4x\r\n", ptr);
|
|
||||||
#endif
|
|
||||||
switch (IINCHIP_READ(Sn_MR(s)) & 0x07)
|
|
||||||
{
|
|
||||||
case Sn_MR_UDP :
|
|
||||||
read_data(s, (uint8 *)ptr, head, 0x08);
|
|
||||||
ptr += 8;
|
|
||||||
// read peer's IP address, port number.
|
|
||||||
addr[0] = head[0];
|
|
||||||
addr[1] = head[1];
|
|
||||||
addr[2] = head[2];
|
|
||||||
addr[3] = head[3];
|
|
||||||
*port = head[4];
|
|
||||||
*port = (*port << 8) + head[5];
|
|
||||||
data_len = head[6];
|
|
||||||
data_len = (data_len << 8) + head[7];
|
|
||||||
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("UDP msg arrived\r\n");
|
|
||||||
printf("source Port : %d\r\n", *port);
|
|
||||||
printf("source IP : %d.%d.%d.%d\r\n", addr[0], addr[1], addr[2], addr[3]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
read_data(s, (uint8 *)ptr, buf, data_len); // data copy.
|
|
||||||
ptr += data_len;
|
|
||||||
|
|
||||||
IINCHIP_WRITE(Sn_RX_RD0(s),(uint8)((ptr & 0xff00) >> 8));
|
|
||||||
IINCHIP_WRITE((Sn_RX_RD0(s) + 1),(uint8)(ptr & 0x00ff));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Sn_MR_IPRAW :
|
|
||||||
read_data(s, (uint8 *)ptr, head, 0x06);
|
|
||||||
ptr += 6;
|
|
||||||
|
|
||||||
addr[0] = head[0];
|
|
||||||
addr[1] = head[1];
|
|
||||||
addr[2] = head[2];
|
|
||||||
addr[3] = head[3];
|
|
||||||
data_len = head[4];
|
|
||||||
data_len = (data_len << 8) + head[5];
|
|
||||||
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("IP RAW msg arrived\r\n");
|
|
||||||
printf("source IP : %d.%d.%d.%d\r\n", addr[0], addr[1], addr[2], addr[3]);
|
|
||||||
#endif
|
|
||||||
read_data(s, (uint8 *)ptr, buf, data_len); // data copy.
|
|
||||||
ptr += data_len;
|
|
||||||
|
|
||||||
IINCHIP_WRITE(Sn_RX_RD0(s),(uint8)((ptr & 0xff00) >> 8));
|
|
||||||
IINCHIP_WRITE((Sn_RX_RD0(s) + 1),(uint8)(ptr & 0x00ff));
|
|
||||||
break;
|
|
||||||
case Sn_MR_MACRAW :
|
|
||||||
read_data(s,(uint8*)ptr,head,2);
|
|
||||||
ptr+=2;
|
|
||||||
data_len = head[0];
|
|
||||||
data_len = (data_len<<8) + head[1] - 2;
|
|
||||||
|
|
||||||
read_data(s,(uint8*) ptr,buf,data_len);
|
|
||||||
ptr += data_len;
|
|
||||||
IINCHIP_WRITE(Sn_RX_RD0(s),(uint8)((ptr & 0xff00) >> 8));
|
|
||||||
IINCHIP_WRITE((Sn_RX_RD0(s) + 1),(uint8)(ptr & 0x00ff));
|
|
||||||
|
|
||||||
#ifdef __DEF_IINCHIP_DGB__
|
|
||||||
printf("MAC RAW msg arrived\r\n");
|
|
||||||
printf("dest mac=%.2X.%.2X.%.2X.%.2X.%.2X.%.2X\r\n",buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]);
|
|
||||||
printf("src mac=%.2X.%.2X.%.2X.%.2X.%.2X.%.2X\r\n",buf[6],buf[7],buf[8],buf[9],buf[10],buf[11]);
|
|
||||||
printf("type =%.2X%.2X\r\n",buf[12],buf[13]);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_RECV);
|
|
||||||
|
|
||||||
/* +20071122[chungs]:wait to process the command... */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
}
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("recvfrom() end ..\r\n");
|
|
||||||
#endif
|
|
||||||
return data_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint16 igmpsend(SOCKET s, const uint8 * buf, uint16 len)
|
|
||||||
{
|
|
||||||
uint8 status=0;
|
|
||||||
// uint8 isr=0;
|
|
||||||
uint16 ret=0;
|
|
||||||
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("igmpsend()\r\n");
|
|
||||||
#endif
|
|
||||||
if (len > getIINCHIP_TxMAX(s)) ret = getIINCHIP_TxMAX(s); // check size not to exceed MAX size.
|
|
||||||
else ret = len;
|
|
||||||
|
|
||||||
if (ret == 0)
|
|
||||||
{
|
|
||||||
;
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("%d Fail[%d]\r\n",len);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// copy data
|
|
||||||
send_data_processing(s, (uint8 *)buf, ret);
|
|
||||||
IINCHIP_WRITE(Sn_CR(s),Sn_CR_SEND);
|
|
||||||
/* +2008.01 bj */
|
|
||||||
while( IINCHIP_READ(Sn_CR(s)) )
|
|
||||||
;
|
|
||||||
/* ------- */
|
|
||||||
|
|
||||||
/* +2008.01 bj */
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
while ( (getISR(s) & Sn_IR_SEND_OK) != Sn_IR_SEND_OK )
|
|
||||||
#else
|
|
||||||
while ( (IINCHIP_READ(Sn_IR(s)) & Sn_IR_SEND_OK) != Sn_IR_SEND_OK )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
status = IINCHIP_READ(Sn_SR(s));
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
if (getISR(s) & Sn_IR_TIMEOUT)
|
|
||||||
#else
|
|
||||||
if (IINCHIP_READ(Sn_IR(s)) & Sn_IR_TIMEOUT)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#ifdef __DEF_IINCHIP_DBG__
|
|
||||||
printf("igmpsend fail.\r\n");
|
|
||||||
#endif
|
|
||||||
/* in case of igmp, if send fails, then socket closed */
|
|
||||||
/* if you want change, remove this code. */
|
|
||||||
close(s);
|
|
||||||
/* ----- */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* +2008.01 bj */
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
putISR(s, getISR(s) & (~Sn_IR_SEND_OK));
|
|
||||||
#else
|
|
||||||
IINCHIP_WRITE(Sn_IR(s), Sn_IR_SEND_OK);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
@file socket.h
|
|
||||||
@brief define function of socket API
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SOCKET_H_
|
|
||||||
#define _SOCKET_H_
|
|
||||||
|
|
||||||
extern uint8 socket(SOCKET s, uint8 protocol, uint16 port, uint8 flag); // Opens a socket(TCP or UDP or IP_RAW mode)
|
|
||||||
extern void close(SOCKET s); // Close socket
|
|
||||||
extern uint8 connect(SOCKET s, uint8 * addr, uint16 port); // Establish TCP connection (Active connection)
|
|
||||||
extern void disconnect(SOCKET s); // disconnect the connection
|
|
||||||
extern uint8 listen(SOCKET s); // Establish TCP connection (Passive connection)
|
|
||||||
extern uint16 send(SOCKET s, const uint8 * buf, uint16 len); // Send data (TCP)
|
|
||||||
extern uint16 recv(SOCKET s, uint8 * buf, uint16 len); // Receive data (TCP)
|
|
||||||
extern uint16 sendto(SOCKET s, const uint8 * buf, uint16 len, uint8 * addr, uint16 port); // Send data (UDP/IP RAW)
|
|
||||||
extern uint16 recvfrom(SOCKET s, uint8 * buf, uint16 len, uint8 * addr, uint16 *port); // Receive data (UDP/IP RAW)
|
|
||||||
|
|
||||||
extern uint16 igmpsend(SOCKET s, const uint8 * buf, uint16 len);
|
|
||||||
#endif
|
|
||||||
/* _SOCKET_H_ */
|
|
@ -1,58 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------------
|
|
||||||
//AVR Mega168 SPI HAL
|
|
||||||
#define BIT0 0x01
|
|
||||||
#define BIT1 0x02
|
|
||||||
#define BIT2 0x04
|
|
||||||
#define BIT3 0x08
|
|
||||||
#define BIT4 0x10
|
|
||||||
#define BIT5 0x20
|
|
||||||
#define BIT6 0x40
|
|
||||||
#define BIT7 0x80
|
|
||||||
|
|
||||||
#define SPI0_SS_BIT BIT2
|
|
||||||
#define SPI0_SS_DDR DDRB
|
|
||||||
#define SPI0_SS_PORT PORTB
|
|
||||||
|
|
||||||
#define SPI0_SCLK_BIT BIT5
|
|
||||||
#define SPI0_SCLK_DDR DDRB
|
|
||||||
#define SPI0_SCLK_PORT PORTB
|
|
||||||
|
|
||||||
#define SPI0_MOSI_BIT BIT3
|
|
||||||
#define SPI0_MOSI_DDR DDRB
|
|
||||||
#define SPI0_MOSI_PORT PORTB
|
|
||||||
|
|
||||||
#define SPI0_MISO_BIT BIT4
|
|
||||||
#define SPI0_MISO_DDR DDRB
|
|
||||||
#define SPI0_MISO_PORT PORTB
|
|
||||||
|
|
||||||
|
|
||||||
#define SPI0_WaitForReceive()
|
|
||||||
#define SPI0_RxData() (SPDR)
|
|
||||||
|
|
||||||
#define SPI0_TxData(Data) (SPDR = Data)
|
|
||||||
#define SPI0_WaitForSend() while( (SPSR & 0x80)==0x00 )
|
|
||||||
|
|
||||||
#define SPI0_SendByte(Data) SPI0_TxData(Data);SPI0_WaitForSend()
|
|
||||||
#define SPI0_RecvBute() SPI0_RxData()
|
|
||||||
|
|
||||||
// PB4(MISO), PB3(MOSI), PB5(SCK), PB2(/SS) // CS=1, waiting for SPI start // SPI mode 0, 4MHz
|
|
||||||
#define SPI0_Init() DDRB |= SPI0_SS_BIT|SPI0_SCLK_BIT|SPI0_MOSI_BIT;\
|
|
||||||
PORTB |= SPI0_SS_BIT; PORTB &= ~(SPI0_SCLK_BIT|SPI0_MOSI_BIT);\
|
|
||||||
SPCR = 0x50
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//IInChip SPI HAL
|
|
||||||
#define IINCHIP_SpiInit SPI0_Init
|
|
||||||
#define IINCHIP_SpiSendData SPI0_SendByte
|
|
||||||
#define IINCHIP_SpiRecvData SPI0_RxData
|
|
||||||
|
|
||||||
|
|
||||||
#define IINCHIP_CS_BIT BIT2
|
|
||||||
#define IINCHIP_CS_DDR DDRB
|
|
||||||
#define IINCHIP_CS_PORT PORTB
|
|
||||||
|
|
||||||
#define IINCHIP_CSInit() (IINCHIP_CS_DDR |= IINCHIP_CS_BIT)
|
|
||||||
#define IINCHIP_CSon() (IINCHIP_CS_PORT |= IINCHIP_CS_BIT)
|
|
||||||
#define IINCHIP_CSoff() (IINCHIP_CS_PORT &= ~IINCHIP_CS_BIT)
|
|
||||||
//-----------------------------------------------------------------------------
|
|
@ -1,165 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
@file type.h
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _TYPE_H_
|
|
||||||
#define _TYPE_H_
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************
|
|
||||||
* attribute for mcu ( types, ... )
|
|
||||||
***************************************************/
|
|
||||||
//#include "mcu_define.h"
|
|
||||||
#define __MCU_AVR__ 1
|
|
||||||
#define __MCU_TYPE__ __MCU_AVR__
|
|
||||||
|
|
||||||
//---- Refer "Rom File Maker Manual Vx.x.pdf"
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#define _ENDIAN_LITTLE_ 0 /**< This must be defined if system is little-endian alignment */
|
|
||||||
#define _ENDIAN_BIG_ 1
|
|
||||||
#define SYSTEM_ENDIAN _ENDIAN_LITTLE_
|
|
||||||
|
|
||||||
#define MAX_SOCK_NUM 4 /**< Maxmium number of socket */
|
|
||||||
#define CLK_CPU F_CPU /**< 8Mhz(for serial) */
|
|
||||||
|
|
||||||
/* ## __DEF_IINCHIP_xxx__ : define option for iinchip driver *****************/
|
|
||||||
//#define __DEF_IINCHIP_DBG__ /* involve debug code in driver (socket.c) */
|
|
||||||
//#define __DEF_IINCHIP_INT__ /**< involve interrupt service routine (socket.c) */
|
|
||||||
//#define __DEF_IINCHIP_PPP__ /* involve pppoe routine (socket.c) */
|
|
||||||
/* If it is defined, the source files(md5.h,md5.c) must be included in your project.
|
|
||||||
Otherwize, the source files must be removed in your project. */
|
|
||||||
|
|
||||||
#define __DEF_IINCHIP_DIRECT_MODE__ 1
|
|
||||||
#define __DEF_IINCHIP_INDIRECT_MODE__ 2
|
|
||||||
#define __DEF_IINCHIP_SPI_MODE__ 3
|
|
||||||
|
|
||||||
//#define __DEF_IINCHIP_BUS__ __DEF_IINCHIP_DIRECT_MODE__
|
|
||||||
//#define __DEF_IINCHIP_BUS__ __DEF_IINCHIP_INDIRECT_MODE__
|
|
||||||
#define __DEF_IINCHIP_BUS__ __DEF_IINCHIP_SPI_MODE__ /*Enable SPI_mode*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief __DEF_IINCHIP_MAP_xxx__ : define memory map for iinchip
|
|
||||||
*/
|
|
||||||
#define __DEF_IINCHIP_MAP_BASE__ 0x8000
|
|
||||||
#if (__DEF_IINCHIP_BUS__ == __DEF_IINCHIP_DIRECT_MODE__)
|
|
||||||
#define COMMON_BASE __DEF_IINCHIP_MAP_BASE__
|
|
||||||
#else
|
|
||||||
#define COMMON_BASE 0x0000
|
|
||||||
#endif
|
|
||||||
#define __DEF_IINCHIP_MAP_TXBUF__ (COMMON_BASE + 0x4000) /* Internal Tx buffer address of the iinchip */
|
|
||||||
#define __DEF_IINCHIP_MAP_RXBUF__ (COMMON_BASE + 0x6000) /* Internal Rx buffer address of the iinchip */
|
|
||||||
|
|
||||||
|
|
||||||
#if (__MCU_TYPE__ == __MCU_AVR__)
|
|
||||||
#ifdef __DEF_IINCHIP_INT__
|
|
||||||
// iinchip use external interrupt 4
|
|
||||||
#define IINCHIP_ISR_DISABLE() (EIMSK &= ~(0x10))
|
|
||||||
#define IINCHIP_ISR_ENABLE() (EIMSK |= 0x10)
|
|
||||||
#define IINCHIP_ISR_GET(X) (X = EIMSK)
|
|
||||||
#define IINCHIP_ISR_SET(X) (EIMSK = X)
|
|
||||||
#else
|
|
||||||
#define IINCHIP_ISR_DISABLE()
|
|
||||||
#define IINCHIP_ISR_ENABLE()
|
|
||||||
#define IINCHIP_ISR_GET(X)
|
|
||||||
#define IINCHIP_ISR_SET(X)
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#error "unknown MCU type"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
#define NULL ((void *) 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//typedef enum { false, true } bool;
|
|
||||||
|
|
||||||
#ifndef _SIZE_T
|
|
||||||
#define _SIZE_T
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The 8-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef char int8;
|
|
||||||
/**
|
|
||||||
* The volatile 8-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile char vint8;
|
|
||||||
/**
|
|
||||||
* The 8-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned char uint8;
|
|
||||||
/**
|
|
||||||
* The volatile 8-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned char vuint8;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The 16-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef int int16;
|
|
||||||
/**
|
|
||||||
* The volatile 16-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile int vint16;
|
|
||||||
/**
|
|
||||||
* The 16-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned int uint16;
|
|
||||||
/**
|
|
||||||
* The volatile 16-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned int vuint16;
|
|
||||||
/**
|
|
||||||
* The 32-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef long int32;
|
|
||||||
/**
|
|
||||||
* The volatile 32-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile long vint32;
|
|
||||||
/**
|
|
||||||
* The 32-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned long uint32;
|
|
||||||
/**
|
|
||||||
* The volatile 32-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned long vuint32;
|
|
||||||
|
|
||||||
/* bsd */
|
|
||||||
typedef uint8 u_char; /**< 8-bit value */
|
|
||||||
typedef uint8 SOCKET;
|
|
||||||
typedef uint16 u_short; /**< 16-bit value */
|
|
||||||
typedef uint16 u_int; /**< 16-bit value */
|
|
||||||
typedef uint32 u_long; /**< 32-bit value */
|
|
||||||
|
|
||||||
typedef union _un_l2cval {
|
|
||||||
u_long lVal;
|
|
||||||
u_char cVal[4];
|
|
||||||
}un_l2cval;
|
|
||||||
|
|
||||||
typedef union _un_i2cval {
|
|
||||||
u_int iVal;
|
|
||||||
u_char cVal[2];
|
|
||||||
}un_i2cval;
|
|
||||||
|
|
||||||
|
|
||||||
/** global define */
|
|
||||||
#define FW_VERSION 0x01010000 /* System F/W Version : 1.1.0.0 */
|
|
||||||
#define HW_VERSION 0x01000000
|
|
||||||
|
|
||||||
|
|
||||||
#define TX_RX_MAX_BUF_SIZE 2048
|
|
||||||
#define TX_BUF 0x1100
|
|
||||||
#define RX_BUF (TX_BUF+TX_RX_MAX_BUF_SIZE)
|
|
||||||
|
|
||||||
#define UART_DEVICE_CNT 1 /**< UART device number */
|
|
||||||
/* #define SUPPORT_UART_ONE */
|
|
||||||
|
|
||||||
#endif /* _TYPE_H_ */
|
|
File diff suppressed because it is too large
Load Diff
@ -1,299 +0,0 @@
|
|||||||
/*
|
|
||||||
@file w5100.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _W5100_H_
|
|
||||||
#define _W5100_H_
|
|
||||||
|
|
||||||
|
|
||||||
#define MR __DEF_IINCHIP_MAP_BASE__
|
|
||||||
#define IDM_OR ((__DEF_IINCHIP_MAP_BASE__ + 0x00))
|
|
||||||
#define IDM_AR0 ((__DEF_IINCHIP_MAP_BASE__ + 0x01))
|
|
||||||
#define IDM_AR1 ((__DEF_IINCHIP_MAP_BASE__ + 0x02))
|
|
||||||
#define IDM_DR ((__DEF_IINCHIP_MAP_BASE__ + 0x03))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Gateway IP Register address
|
|
||||||
*/
|
|
||||||
#define GAR0 (COMMON_BASE + 0x0001)
|
|
||||||
/**
|
|
||||||
@brief Subnet mask Register address
|
|
||||||
*/
|
|
||||||
#define SUBR0 (COMMON_BASE + 0x0005)
|
|
||||||
/**
|
|
||||||
@brief Source MAC Register address
|
|
||||||
*/
|
|
||||||
#define SHAR0 (COMMON_BASE + 0x0009)
|
|
||||||
/**
|
|
||||||
@brief Source IP Register address
|
|
||||||
*/
|
|
||||||
#define SIPR0 (COMMON_BASE + 0x000F)
|
|
||||||
/**
|
|
||||||
@brief Interrupt Register
|
|
||||||
*/
|
|
||||||
#define IR (COMMON_BASE + 0x0015)
|
|
||||||
/**
|
|
||||||
@brief Interrupt mask register
|
|
||||||
*/
|
|
||||||
#define IMR (COMMON_BASE + 0x0016)
|
|
||||||
/**
|
|
||||||
@brief Timeout register address( 1 is 100us )
|
|
||||||
*/
|
|
||||||
#define RTR0 (COMMON_BASE + 0x0017)
|
|
||||||
/**
|
|
||||||
@brief Retry count reigster
|
|
||||||
*/
|
|
||||||
#define RCR (COMMON_BASE + 0x0019)
|
|
||||||
/**
|
|
||||||
@brief Receive memory size reigster
|
|
||||||
*/
|
|
||||||
#define RMSR (COMMON_BASE + 0x001A)
|
|
||||||
/**
|
|
||||||
@brief Transmit memory size reigster
|
|
||||||
*/
|
|
||||||
#define TMSR (COMMON_BASE + 0x001B)
|
|
||||||
/**
|
|
||||||
@brief Authentication type register address in PPPoE mode
|
|
||||||
*/
|
|
||||||
#define PATR0 (COMMON_BASE + 0x001C)
|
|
||||||
//#define PPPALGO (COMMON_BASE + 0x001D)
|
|
||||||
#define PTIMER (COMMON_BASE + 0x0028)
|
|
||||||
#define PMAGIC (COMMON_BASE + 0x0029)
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Unreachable IP register address in UDP mode
|
|
||||||
*/
|
|
||||||
#define UIPR0 (COMMON_BASE + 0x002A)
|
|
||||||
/**
|
|
||||||
@brief Unreachable Port register address in UDP mode
|
|
||||||
*/
|
|
||||||
#define UPORT0 (COMMON_BASE + 0x002E)
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief socket register
|
|
||||||
*/
|
|
||||||
#define CH_BASE (COMMON_BASE + 0x0400)
|
|
||||||
/**
|
|
||||||
@brief size of each channel register map
|
|
||||||
*/
|
|
||||||
#define CH_SIZE 0x0100
|
|
||||||
/**
|
|
||||||
@brief socket Mode register
|
|
||||||
*/
|
|
||||||
#define Sn_MR(ch) (CH_BASE + ch * CH_SIZE + 0x0000)
|
|
||||||
/**
|
|
||||||
@brief channel Sn_CR register
|
|
||||||
*/
|
|
||||||
#define Sn_CR(ch) (CH_BASE + ch * CH_SIZE + 0x0001)
|
|
||||||
/**
|
|
||||||
@brief channel interrupt register
|
|
||||||
*/
|
|
||||||
#define Sn_IR(ch) (CH_BASE + ch * CH_SIZE + 0x0002)
|
|
||||||
/**
|
|
||||||
@brief channel status register
|
|
||||||
*/
|
|
||||||
#define Sn_SR(ch) (CH_BASE + ch * CH_SIZE + 0x0003)
|
|
||||||
/**
|
|
||||||
@brief source port register
|
|
||||||
*/
|
|
||||||
#define Sn_PORT0(ch) (CH_BASE + ch * CH_SIZE + 0x0004)
|
|
||||||
/**
|
|
||||||
@brief Peer MAC register address
|
|
||||||
*/
|
|
||||||
#define Sn_DHAR0(ch) (CH_BASE + ch * CH_SIZE + 0x0006)
|
|
||||||
/**
|
|
||||||
@brief Peer IP register address
|
|
||||||
*/
|
|
||||||
#define Sn_DIPR0(ch) (CH_BASE + ch * CH_SIZE + 0x000C)
|
|
||||||
/**
|
|
||||||
@brief Peer port register address
|
|
||||||
*/
|
|
||||||
#define Sn_DPORT0(ch) (CH_BASE + ch * CH_SIZE + 0x0010)
|
|
||||||
/**
|
|
||||||
@brief Maximum Segment Size(Sn_MSSR0) register address
|
|
||||||
*/
|
|
||||||
#define Sn_MSSR0(ch) (CH_BASE + ch * CH_SIZE + 0x0012)
|
|
||||||
/**
|
|
||||||
@brief Protocol of IP Header field register in IP raw mode
|
|
||||||
*/
|
|
||||||
#define Sn_PROTO(ch) (CH_BASE + ch * CH_SIZE + 0x0014)
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief IP Type of Service(TOS) Register
|
|
||||||
*/
|
|
||||||
#define Sn_TOS(ch) (CH_BASE + ch * CH_SIZE + 0x0015)
|
|
||||||
/**
|
|
||||||
@brief IP Time to live(TTL) Register
|
|
||||||
*/
|
|
||||||
#define Sn_TTL(ch) (CH_BASE + ch * CH_SIZE + 0x0016)
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Transmit free memory size register
|
|
||||||
*/
|
|
||||||
#define Sn_TX_FSR0(ch) (CH_BASE + ch * CH_SIZE + 0x0020)
|
|
||||||
/**
|
|
||||||
@brief Transmit memory read pointer register address
|
|
||||||
*/
|
|
||||||
#define Sn_TX_RD0(ch) (CH_BASE + ch * CH_SIZE + 0x0022)
|
|
||||||
/**
|
|
||||||
@brief Transmit memory write pointer register address
|
|
||||||
*/
|
|
||||||
#define Sn_TX_WR0(ch) (CH_BASE + ch * CH_SIZE + 0x0024)
|
|
||||||
/**
|
|
||||||
@brief Received data size register
|
|
||||||
*/
|
|
||||||
#define Sn_RX_RSR0(ch) (CH_BASE + ch * CH_SIZE + 0x0026)
|
|
||||||
/**
|
|
||||||
@brief Read point of Receive memory
|
|
||||||
*/
|
|
||||||
#define Sn_RX_RD0(ch) (CH_BASE + ch * CH_SIZE + 0x0028)
|
|
||||||
/**
|
|
||||||
@brief Write point of Receive memory
|
|
||||||
*/
|
|
||||||
#define Sn_RX_WR0(ch) (CH_BASE + ch * CH_SIZE + 0x002A)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* MODE register values */
|
|
||||||
#define MR_RST 0x80 /**< reset */
|
|
||||||
#define MR_PB 0x10 /**< ping block */
|
|
||||||
#define MR_PPPOE 0x08 /**< enable pppoe */
|
|
||||||
#define MR_LB 0x04 /**< little or big endian selector in indirect mode */
|
|
||||||
#define MR_AI 0x02 /**< auto-increment in indirect mode */
|
|
||||||
#define MR_IND 0x01 /**< enable indirect mode */
|
|
||||||
|
|
||||||
/* IR register values */
|
|
||||||
#define IR_CONFLICT 0x80 /**< check ip confict */
|
|
||||||
#define IR_UNREACH 0x40 /**< get the destination unreachable message in UDP sending */
|
|
||||||
#define IR_PPPoE 0x20 /**< get the PPPoE close message */
|
|
||||||
#define IR_SOCK(ch) (0x01 << ch) /**< check socket interrupt */
|
|
||||||
|
|
||||||
/* Sn_MR values */
|
|
||||||
#define Sn_MR_CLOSE 0x00 /**< unused socket */
|
|
||||||
#define Sn_MR_TCP 0x01 /**< TCP */
|
|
||||||
#define Sn_MR_UDP 0x02 /**< UDP */
|
|
||||||
#define Sn_MR_IPRAW 0x03 /**< IP LAYER RAW SOCK */
|
|
||||||
#define Sn_MR_MACRAW 0x04 /**< MAC LAYER RAW SOCK */
|
|
||||||
#define Sn_MR_PPPOE 0x05 /**< PPPoE */
|
|
||||||
#define Sn_MR_ND 0x20 /**< No Delayed Ack(TCP) flag */
|
|
||||||
#define Sn_MR_MULTI 0x80 /**< support multicating */
|
|
||||||
|
|
||||||
|
|
||||||
/* Sn_CR values */
|
|
||||||
#define Sn_CR_OPEN 0x01 /**< initialize or open socket */
|
|
||||||
#define Sn_CR_LISTEN 0x02 /**< wait connection request in tcp mode(Server mode) */
|
|
||||||
#define Sn_CR_CONNECT 0x04 /**< send connection request in tcp mode(Client mode) */
|
|
||||||
#define Sn_CR_DISCON 0x08 /**< send closing reqeuset in tcp mode */
|
|
||||||
#define Sn_CR_CLOSE 0x10 /**< close socket */
|
|
||||||
#define Sn_CR_SEND 0x20 /**< updata txbuf pointer, send data */
|
|
||||||
#define Sn_CR_SEND_MAC 0x21 /**< send data with MAC address, so without ARP process */
|
|
||||||
#define Sn_CR_SEND_KEEP 0x22 /**< send keep alive message */
|
|
||||||
#define Sn_CR_RECV 0x40 /**< update rxbuf pointer, recv data */
|
|
||||||
|
|
||||||
#ifdef __DEF_IINCHIP_PPP__
|
|
||||||
#define Sn_CR_PCON 0x23
|
|
||||||
#define Sn_CR_PDISCON 0x24
|
|
||||||
#define Sn_CR_PCR 0x25
|
|
||||||
#define Sn_CR_PCN 0x26
|
|
||||||
#define Sn_CR_PCJ 0x27
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Sn_IR values */
|
|
||||||
#ifdef __DEF_IINCHIP_PPP__
|
|
||||||
#define Sn_IR_PRECV 0x80
|
|
||||||
#define Sn_IR_PFAIL 0x40
|
|
||||||
#define Sn_IR_PNEXT 0x20
|
|
||||||
#endif
|
|
||||||
#define Sn_IR_SEND_OK 0x10 /**< complete sending */
|
|
||||||
#define Sn_IR_TIMEOUT 0x08 /**< assert timeout */
|
|
||||||
#define Sn_IR_RECV 0x04 /**< receiving data */
|
|
||||||
#define Sn_IR_DISCON 0x02 /**< closed socket */
|
|
||||||
#define Sn_IR_CON 0x01 /**< established connection */
|
|
||||||
|
|
||||||
/* Sn_SR values */
|
|
||||||
#define SOCK_CLOSED 0x00 /**< closed */
|
|
||||||
#define SOCK_INIT 0x13 /**< init state */
|
|
||||||
#define SOCK_LISTEN 0x14 /**< listen state */
|
|
||||||
#define SOCK_SYNSENT 0x15 /**< connection state */
|
|
||||||
#define SOCK_SYNRECV 0x16 /**< connection state */
|
|
||||||
#define SOCK_ESTABLISHED 0x17 /**< success to connect */
|
|
||||||
#define SOCK_FIN_WAIT 0x18 /**< closing state */
|
|
||||||
#define SOCK_CLOSING 0x1A /**< closing state */
|
|
||||||
#define SOCK_TIME_WAIT 0x1B /**< closing state */
|
|
||||||
#define SOCK_CLOSE_WAIT 0x1C /**< closing state */
|
|
||||||
#define SOCK_LAST_ACK 0x1D /**< closing state */
|
|
||||||
#define SOCK_UDP 0x22 /**< udp socket */
|
|
||||||
#define SOCK_IPRAW 0x32 /**< ip raw mode socket */
|
|
||||||
#define SOCK_MACRAW 0x42 /**< mac raw mode socket */
|
|
||||||
#define SOCK_PPPOE 0x5F /**< pppoe socket */
|
|
||||||
|
|
||||||
/* IP PROTOCOL */
|
|
||||||
#define IPPROTO_IP 0 /**< Dummy for IP */
|
|
||||||
#define IPPROTO_ICMP 1 /**< Control message protocol */
|
|
||||||
#define IPPROTO_IGMP 2 /**< Internet group management protocol */
|
|
||||||
#define IPPROTO_GGP 3 /**< Gateway^2 (deprecated) */
|
|
||||||
#define IPPROTO_TCP 6 /**< TCP */
|
|
||||||
#define IPPROTO_PUP 12 /**< PUP */
|
|
||||||
#define IPPROTO_UDP 17 /**< UDP */
|
|
||||||
#define IPPROTO_IDP 22 /**< XNS idp */
|
|
||||||
#define IPPROTO_ND 77 /**< UNOFFICIAL net disk protocol */
|
|
||||||
#define IPPROTO_RAW 255 /**< Raw IP packet */
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************
|
|
||||||
* iinchip access function
|
|
||||||
*********************************************************/
|
|
||||||
extern uint8 IINCHIP_READ(uint16 addr);
|
|
||||||
extern uint8 IINCHIP_WRITE(uint16 addr,uint8 data);
|
|
||||||
extern uint16 wiz_read_buf(uint16 addr, uint8* buf,uint16 len);
|
|
||||||
extern uint16 wiz_write_buf(uint16 addr,uint8* buf,uint16 len);
|
|
||||||
|
|
||||||
extern void iinchip_init(void); // reset iinchip
|
|
||||||
extern void sysinit(uint8 tx_size, uint8 rx_size); // setting tx/rx buf size
|
|
||||||
extern uint8 getISR(uint8 s);
|
|
||||||
extern void putISR(uint8 s, uint8 val);
|
|
||||||
extern uint16 getIINCHIP_RxMAX(uint8 s);
|
|
||||||
extern uint16 getIINCHIP_TxMAX(uint8 s);
|
|
||||||
extern uint16 getIINCHIP_RxMASK(uint8 s);
|
|
||||||
extern uint16 getIINCHIP_TxMASK(uint8 s);
|
|
||||||
extern uint16 getIINCHIP_RxBASE(uint8 s);
|
|
||||||
extern uint16 getIINCHIP_TxBASE(uint8 s);
|
|
||||||
extern void setGAR(uint8 * addr); // set gateway address
|
|
||||||
extern void setSUBR(uint8 * addr); // set subnet mask address
|
|
||||||
extern void setSHAR(uint8 * addr); // set local MAC address
|
|
||||||
extern void setSIPR(uint8 * addr); // set local IP address
|
|
||||||
extern void setRTR(uint16 timeout); // set retry duration for data transmission, connection, closing ...
|
|
||||||
extern void setRCR(uint8 retry); // set retry count (above the value, assert timeout interrupt)
|
|
||||||
extern void setIMR(uint8 mask); // set interrupt mask.
|
|
||||||
extern void getGAR(uint8 * addr);
|
|
||||||
extern void getSUBR(uint8 * addr);
|
|
||||||
extern void getSHAR(uint8 * addr);
|
|
||||||
extern void getSIPR(uint8 * addr);
|
|
||||||
extern uint8 getIR( void );
|
|
||||||
extern void setSn_MSS(SOCKET s, uint16 Sn_MSSR0); // set maximum segment size
|
|
||||||
extern void setSn_PROTO(SOCKET s, uint8 proto); // set IP Protocol value using IP-Raw mode
|
|
||||||
extern uint8 getSn_IR(SOCKET s); // get socket interrupt status
|
|
||||||
extern uint8 getSn_SR(SOCKET s); // get socket status
|
|
||||||
extern uint16 getSn_TX_FSR(SOCKET s); // get socket TX free buf size
|
|
||||||
extern uint16 getSn_RX_RSR(SOCKET s); // get socket RX recv buf size
|
|
||||||
extern void setSn_DHAR(SOCKET s, uint8 * addr);
|
|
||||||
extern void setSn_DIPR(SOCKET s, uint8 * addr);
|
|
||||||
extern void setSn_DPORT(SOCKET s, uint8 * addr);
|
|
||||||
extern void getSn_DHAR(SOCKET s, uint8 * addr);
|
|
||||||
extern void getSn_DIPR(SOCKET s, uint8 * addr);
|
|
||||||
extern void getSn_DPORT(SOCKET s, uint8 * addr);
|
|
||||||
extern void setSn_TTL(SOCKET s, uint8 ttl);
|
|
||||||
extern void setMR(uint8 val);
|
|
||||||
|
|
||||||
#ifdef __DEF_IINCHIP_PPP__
|
|
||||||
extern uint8 pppinit(uint8 *id, uint8 idlen, uint8 *passwd, uint8 passwdlen);
|
|
||||||
extern uint8 pppterm(uint8 *mac,uint8 *sessionid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void send_data_processing(SOCKET s, uint8 *data, uint16 len);
|
|
||||||
extern void recv_data_processing(SOCKET s, uint8 *data, uint16 len);
|
|
||||||
extern void read_data(SOCKET s, vuint8 * src, vuint8 * dst, uint16 len);
|
|
||||||
extern void write_data(SOCKET s, vuint8 * src, vuint8 * dst, uint16 len);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,302 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
See file LICENSE.txt for further informations on licensing terms.
|
|
||||||
|
|
||||||
formatted using the GNU C formatting and indenting
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: use Program Control to load stored profiles from EEPROM
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Firmata.h>
|
|
||||||
#include <Servo.h>
|
|
||||||
|
|
||||||
/*==============================================================================
|
|
||||||
* GLOBAL VARIABLES
|
|
||||||
*============================================================================*/
|
|
||||||
|
|
||||||
/* analog inputs */
|
|
||||||
int analogInputsToReport = 0; // bitwise array to store pin reporting
|
|
||||||
int analogPin = 0; // counter for reading analog pins
|
|
||||||
|
|
||||||
/* digital pins */
|
|
||||||
byte reportPINs[TOTAL_PORTS]; // PIN == input port
|
|
||||||
byte previousPINs[TOTAL_PORTS]; // PIN == input port
|
|
||||||
byte pinStatus[TOTAL_DIGITAL_PINS]; // store pin status, default OUTPUT
|
|
||||||
byte portStatus[TOTAL_PORTS];
|
|
||||||
|
|
||||||
/* timer variables */
|
|
||||||
unsigned long currentMillis; // store the current value from millis()
|
|
||||||
unsigned long nextExecuteMillis; // for comparison with currentMillis
|
|
||||||
int samplingInterval = 19; // how often to run the main loop (in ms)
|
|
||||||
|
|
||||||
Servo servos[MAX_SERVOS];
|
|
||||||
|
|
||||||
/*==============================================================================
|
|
||||||
* FUNCTIONS
|
|
||||||
*============================================================================*/
|
|
||||||
|
|
||||||
void outputPort(byte portNumber, byte portValue)
|
|
||||||
{
|
|
||||||
portValue = portValue &~ portStatus[portNumber];
|
|
||||||
if(previousPINs[portNumber] != portValue) {
|
|
||||||
Firmata.sendDigitalPort(portNumber, portValue);
|
|
||||||
previousPINs[portNumber] = portValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* check all the active digital inputs for change of state, then add any events
|
|
||||||
* to the Serial output queue using Serial.print() */
|
|
||||||
void checkDigitalInputs(void)
|
|
||||||
{
|
|
||||||
byte i, tmp;
|
|
||||||
for(i=0; i < TOTAL_PORTS; i++) {
|
|
||||||
if(reportPINs[i]) {
|
|
||||||
switch(i) {
|
|
||||||
case 0:
|
|
||||||
outputPort(0, PIND &~ B00000011); // ignore Rx/Tx 0/1
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
outputPort(1, PINB);
|
|
||||||
break;
|
|
||||||
case ANALOG_PORT:
|
|
||||||
outputPort(ANALOG_PORT, PINC);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
/* sets the pin mode to the correct state and sets the relevant bits in the
|
|
||||||
* two bit-arrays that track Digital I/O and PWM status
|
|
||||||
*/
|
|
||||||
void setPinModeCallback(byte pin, int mode) {
|
|
||||||
byte port = 0;
|
|
||||||
byte offset = 0;
|
|
||||||
|
|
||||||
// TODO: abstract for different boards
|
|
||||||
if (pin < 8) {
|
|
||||||
port = 0;
|
|
||||||
offset = 0;
|
|
||||||
} else if (pin < 14) {
|
|
||||||
port = 1;
|
|
||||||
offset = 8;
|
|
||||||
} else if (pin < 22) {
|
|
||||||
port = 2;
|
|
||||||
offset = 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pin > 1) { // ignore RxTx (pins 0 and 1)
|
|
||||||
if (isServoSupportedPin(pin) && mode != SERVO)
|
|
||||||
if (servos[pin - FIRST_SERVO_PIN].attached())
|
|
||||||
servos[pin - FIRST_SERVO_PIN].detach();
|
|
||||||
if(pin > 13)
|
|
||||||
reportAnalogCallback(pin - 14, mode == ANALOG ? 1 : 0); // turn on/off reporting
|
|
||||||
switch(mode) {
|
|
||||||
case ANALOG:
|
|
||||||
digitalWrite(pin, LOW); // disable internal pull-ups and fall thru to 'case INPUT:'
|
|
||||||
case INPUT:
|
|
||||||
pinStatus[pin] = mode;
|
|
||||||
pinMode(pin, INPUT);
|
|
||||||
portStatus[port] = portStatus[port] &~ (1 << (pin - offset));
|
|
||||||
break;
|
|
||||||
case OUTPUT:
|
|
||||||
digitalWrite(pin, LOW); // disable PWM and fall thru to 'case PWM:'
|
|
||||||
case PWM:
|
|
||||||
pinStatus[pin] = mode;
|
|
||||||
pinMode(pin, OUTPUT);
|
|
||||||
portStatus[port] = portStatus[port] | (1 << (pin - offset));
|
|
||||||
break;
|
|
||||||
case SERVO:
|
|
||||||
// TODO: Support Arduino Mega
|
|
||||||
if (isServoSupportedPin(pin)) {
|
|
||||||
pinStatus[pin] = mode;
|
|
||||||
if (!servos[pin - FIRST_SERVO_PIN].attached())
|
|
||||||
servos[pin - FIRST_SERVO_PIN].attach(pin);
|
|
||||||
} else
|
|
||||||
Firmata.sendString("Servo only on pins from 2 to 13");
|
|
||||||
break;
|
|
||||||
case I2C:
|
|
||||||
pinStatus[pin] = mode;
|
|
||||||
Firmata.sendString("I2C mode not yet supported");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Firmata.sendString("Unknown pin mode"); // TODO: put error msgs in EEPROM
|
|
||||||
}
|
|
||||||
// TODO: save status to EEPROM here, if changed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void analogWriteCallback(byte pin, int value)
|
|
||||||
{
|
|
||||||
switch(pinStatus[pin]) {
|
|
||||||
case SERVO:
|
|
||||||
if (isServoSupportedPin(pin))
|
|
||||||
servos[pin - FIRST_SERVO_PIN].write(value);
|
|
||||||
break;
|
|
||||||
case PWM:
|
|
||||||
analogWrite(pin, value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void digitalWriteCallback(byte port, int value)
|
|
||||||
{
|
|
||||||
switch(port) {
|
|
||||||
case 0: // pins 2-7 (don't change Rx/Tx, pins 0 and 1)
|
|
||||||
// 0xFF03 == B1111111100000011 0x03 == B00000011
|
|
||||||
PORTD = (value &~ 0xFF03) | (PORTD & 0x03);
|
|
||||||
break;
|
|
||||||
case 1: // pins 8-13 (14,15 are disabled for the crystal)
|
|
||||||
PORTB = (byte)value;
|
|
||||||
break;
|
|
||||||
case 2: // analog pins used as digital
|
|
||||||
byte pin;
|
|
||||||
byte pinModeMask;
|
|
||||||
for(pin=0; pin<8; pin++)
|
|
||||||
if(pinStatus[pin] == OUTPUT)
|
|
||||||
pinModeMask += 1 << pin;
|
|
||||||
PORTC = (byte)value & pinModeMask;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
/* sets bits in a bit array (int) to toggle the reporting of the analogIns
|
|
||||||
*/
|
|
||||||
//void FirmataClass::setAnalogPinReporting(byte pin, byte state) {
|
|
||||||
//}
|
|
||||||
void reportAnalogCallback(byte pin, int value)
|
|
||||||
{
|
|
||||||
if(value == 0) {
|
|
||||||
analogInputsToReport = analogInputsToReport &~ (1 << pin);
|
|
||||||
}
|
|
||||||
else { // everything but 0 enables reporting of that pin
|
|
||||||
analogInputsToReport = analogInputsToReport | (1 << pin);
|
|
||||||
}
|
|
||||||
// TODO: save status to EEPROM here, if changed
|
|
||||||
}
|
|
||||||
|
|
||||||
void reportDigitalCallback(byte port, int value)
|
|
||||||
{
|
|
||||||
reportPINs[port] = (byte)value;
|
|
||||||
if(port == ANALOG_PORT) // turn off analog reporting when used as digital
|
|
||||||
analogInputsToReport = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*==============================================================================
|
|
||||||
* SYSEX-BASED commands
|
|
||||||
*============================================================================*/
|
|
||||||
|
|
||||||
void sysexCallback(byte command, byte argc, byte *argv)
|
|
||||||
{
|
|
||||||
switch(command) {
|
|
||||||
case SERVO_CONFIG:
|
|
||||||
if(argc > 4) {
|
|
||||||
// these vars are here for clarity, they'll optimized away by the compiler
|
|
||||||
byte pin = argv[0];
|
|
||||||
int minPulse = argv[1] + (argv[2] << 7);
|
|
||||||
int maxPulse = argv[3] + (argv[4] << 7);
|
|
||||||
|
|
||||||
if (isServoSupportedPin(pin)) {
|
|
||||||
// servos are pins from 2 to 13, so offset for array
|
|
||||||
if (servos[pin - FIRST_SERVO_PIN].attached())
|
|
||||||
servos[pin - FIRST_SERVO_PIN].detach();
|
|
||||||
servos[pin - FIRST_SERVO_PIN].attach(pin, minPulse, maxPulse);
|
|
||||||
setPinModeCallback(pin, SERVO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SAMPLING_INTERVAL:
|
|
||||||
if (argc > 1)
|
|
||||||
samplingInterval = argv[0] + (argv[1] << 7);
|
|
||||||
else
|
|
||||||
Firmata.sendString("Not enough data");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isServoSupportedPin(byte pin)
|
|
||||||
{
|
|
||||||
return ((FIRST_SERVO_PIN <= pin) && (pin <= (FIRST_SERVO_PIN + MAX_SERVOS)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*==============================================================================
|
|
||||||
* SETUP()
|
|
||||||
*============================================================================*/
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
byte i;
|
|
||||||
|
|
||||||
Firmata.setFirmwareVersion(2, 1);
|
|
||||||
|
|
||||||
Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
|
|
||||||
Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
|
|
||||||
Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
|
|
||||||
Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
|
|
||||||
Firmata.attach(SET_PIN_MODE, setPinModeCallback);
|
|
||||||
Firmata.attach(START_SYSEX, sysexCallback);
|
|
||||||
|
|
||||||
portStatus[0] = B00000011; // ignore Tx/RX pins
|
|
||||||
portStatus[1] = B11000000; // ignore 14/15 pins
|
|
||||||
portStatus[2] = B00000000;
|
|
||||||
|
|
||||||
for(i=0; i < FIRST_ANALOG_PIN; ++i) {
|
|
||||||
setPinModeCallback(i,OUTPUT);
|
|
||||||
}
|
|
||||||
// set all outputs to 0 to make sure internal pull-up resistors are off
|
|
||||||
PORTB = 0; // pins 8-15
|
|
||||||
PORTC = 0; // analog port
|
|
||||||
PORTD = 0; // pins 0-7
|
|
||||||
|
|
||||||
// TODO rethink the init, perhaps it should report analog on default
|
|
||||||
for(i=0; i<TOTAL_PORTS; ++i) {
|
|
||||||
reportPINs[i] = false;
|
|
||||||
}
|
|
||||||
// TODO: load state from EEPROM here
|
|
||||||
|
|
||||||
/* send digital inputs here, if enabled, to set the initial state on the
|
|
||||||
* host computer, since once in the loop(), this firmware will only send
|
|
||||||
* digital data on change. */
|
|
||||||
if(reportPINs[0]) outputPort(0, PIND &~ B00000011); // ignore Rx/Tx 0/1
|
|
||||||
if(reportPINs[1]) outputPort(1, PINB);
|
|
||||||
if(reportPINs[ANALOG_PORT]) outputPort(ANALOG_PORT, PINC);
|
|
||||||
|
|
||||||
Firmata.begin(57600);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*==============================================================================
|
|
||||||
* LOOP()
|
|
||||||
*============================================================================*/
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
/* DIGITALREAD - as fast as possible, check for changes and output them */
|
|
||||||
checkDigitalInputs();
|
|
||||||
currentMillis = millis();
|
|
||||||
if(currentMillis > nextExecuteMillis) {
|
|
||||||
nextExecuteMillis = currentMillis + samplingInterval;
|
|
||||||
/* SERIALREAD - Serial.read() uses a 128 byte circular buffer, so handle
|
|
||||||
* all serialReads at once, i.e. empty the buffer */
|
|
||||||
while(Firmata.available())
|
|
||||||
Firmata.processInput();
|
|
||||||
/* SEND FTDI WRITE BUFFER - make sure that the FTDI buffer doesn't go over
|
|
||||||
* 60 bytes. Ideally this could send an "event character" every 4 ms to
|
|
||||||
* trigger the buffer to dump. */
|
|
||||||
|
|
||||||
/* ANALOGREAD - do all of the analogReads() once per poll cycle */
|
|
||||||
for(analogPin=0;analogPin<TOTAL_ANALOG_PINS;analogPin++) {
|
|
||||||
if( analogInputsToReport & (1 << analogPin) ) {
|
|
||||||
Firmata.sendAnalog(analogPin, analogRead(analogPin));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Abs </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>abs(x)</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Computes the absolute value of a number.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: the number
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p><strong>x</strong>: if <strong>x</strong> is greater than or equal to 0.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><strong>-x</strong>: if <strong>x</strong> is less than 0.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Warning</h4>
|
|
||||||
<p>Because of the way the abs() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>
|
|
||||||
abs(a++); // avoid this - yields incorrect results
|
|
||||||
|
|
||||||
a++; // use this instead -
|
|
||||||
abs(a); // keep other math outside the function
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,107 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - AnalogRead </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>analogRead()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on the Mini and Nano), 10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>It takes about 100 us (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>analogRead(pin)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>pin: the number of the analog input pin to read from (0 to 5 on most boards, 0 to 7 on the Mini and Nano)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>int (0 to 1023)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Note</h4>
|
|
||||||
<p>If the analog input pin is not connected to anything, the value returned by analogRead() will fluctuate based on a number of factors (e.g. the values of the other analog inputs, how close your hand is to the board, etc.).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
int analogPin = 3; // potentiometer wiper (middle terminal) connected to analog pin 3
|
|
||||||
// outside leads to ground and +5V
|
|
||||||
int val = 0; // variable to store the value read
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Serial.begin(9600); // setup serial
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
val = analogRead(analogPin); // read the input pin
|
|
||||||
Serial.println(val); // debug value
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='AnalogWrite.html'>analogWrite</a>()
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/AnalogInputPins'>Tutorial: Analog Input Pins</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/RCtime'>RCtime</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,99 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - AnalogReference </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>analogReference(type)</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Configures the reference voltage used for analog input. The analogRead() function will return 1023 for an input equal to the reference voltage. The options are:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ul><li>DEFAULT: the default analog reference of 5 volts.
|
|
||||||
</li><li>INTERNAL: an built-in reference, equal to 1.1 volts on the <span class='wikiword'>ATmega168</span> and 2.56 volts on the <span class='wikiword'>ATmega8</span>.
|
|
||||||
</li><li>EXTERNAL: the voltage applied to the AREF pin is used as the reference.
|
|
||||||
</li></ul><p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>type: which type of reference to use (DEFAULT, INTERNAL, or EXTERNAL).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>None.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Warning</h4>
|
|
||||||
<p>It is a good idea to connect external voltages to the AREF pin through a 5K resistor. This will prevent possible internal damage to the Atmega chip if analogReference() software settings are incompatible with the current hardware setup. Note that the resistor will alter the voltage that gets used as the reference because there is an internal 32K resistor on the AREF pin. The two act as a voltage divider, so, for example, 2.5V applied through the resistor will yield ~2.2V at the AREF pin.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Connecting external voltages through a resistor makes it possible to switch the AREF voltage on the fly, say from the 5 volt DEFAULT setting, to a 3.3 volt EXTERNAL setting (and applied voltage), without the hardware setup affecting either ADC configuration.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Use of the AREF pin</h4>
|
|
||||||
<p>The voltage applied to the AREF pin directly governs the ADC and sets the voltage at which the ADC will report its highest reading, 1023. Lower voltages applied to ADC (analog) pins will be scaled proportionally, so at the DEFAULT setting (5 volt internal connection), 2.5 volts on an analog pin will report approximately 512.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The default configuration on all Arduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to the AREF pin in the DEFAULT setting could damage the ATMEGA chip.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The AREF pin may also be connected internally to an (internal) 1.1 volt source (or 2.56 on the <span class='wikiword'>ATmega8</span>) with analogReference(INTERNAL). With this setting voltages applied to the ADC (analog) pins that are at or above the reference will report 1023 when read with analogRead. Lower voltages will report proportional values, so 0.55 volts will report about 512.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the 1.1 (internally supplied) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied (erroneously) to AREF pin while using the INTERNAL setting will not damage the chip, but will totally override the 1.1 volt source, and ADC readings will be governed by the external voltage. It is still desirable to connect any external voltage to the AREF pin however, through a 5K resistor to avoid the problem cited above.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The correct software setting for using the AREF pin with an external voltage is analogReference(EXTERNAL). This disconnects both of the internal references and the voltage applied externally to the AREF pin sets the reference voltage for the ADC.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/AnalogInputPins'>Description of the analog input pins</a>
|
|
||||||
</li><li><a class='wikilink' href='AnalogRead.html'>analogRead</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,115 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - AnalogWrite </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>analogWrite()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Writes an analog value (<a class='wikilink' href='http://arduino.cc/en/Tutorial/PWM'>PWM wave</a>) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to <strong>analogWrite()</strong>, the pin will generate a steady square wave of the specified duty cycle until the next call to <strong>analogWrite()</strong> (or a call to <strong>digitalRead()</strong> or <strong>digitalWrite()</strong> on the same pin). The frequency of the PWM signal is approximately 490 Hz.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>On newer Arduino boards (including the Mini and BT) with the <span class='wikiword'>ATmega168</span> chip, this function works on pins 3, 5, 6, 9, 10, and 11. Older USB and serial Arduino boards with an <span class='wikiword'>ATmega8</span> only support analogWrite() on pins 9, 10, and 11.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>analogWrite(pin, value)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>pin: the pin to write to.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>value: the duty cycle: between 0 (always off) and 255 (always on).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>nothing
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Notes and Known Issues</h4>
|
|
||||||
<p><em>analogWrite</em> has nothing whatsoever to do with the analog pins or <em>analogRead</em>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>You do not need to call pinMode() to set the pin as an output before calling analogWrite().
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the millis() and delay() functions, which share the same internal timer used to generate those PWM outputs. This will be noticed mostly on low duty-cycle settings (e.g 0 - 10) and may result in analogWrite(x, 0) not fully turning off the output on pins 5 & 6, as one would expect.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<p>Sets the output to the LED proportional to the value read from the potentiometer.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>
|
|
||||||
int ledPin = 9; // LED connected to digital pin 9
|
|
||||||
int analogPin = 3; // potentiometer connected to analog pin 3
|
|
||||||
int val = 0; // variable to store the read value
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
pinMode(ledPin, OUTPUT); // sets the pin as output
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
val = analogRead(analogPin); // read the input pin
|
|
||||||
analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='AnalogRead.html'>analogRead</a>()
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/PWM'>Tutorial: PWM</a>
|
|
||||||
</li><li><a class='urllink' href='http://www.arduino.cc/playground/Main/TimerPWMCheatsheet' rel='nofollow'>Adjusting Arduino PWM Frequencies</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,100 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Arithmetic </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Addition, Subtraction, Multiplication, & Division</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>These operators return the sum, difference, product, or quotient (respectively) of the two operands. The operation is conducted using the data type of the operands, so, for example, <code>9 / 4</code> gives <code>2</code> since 9 and 4 are ints. This also means that the operation can overflow if the result is larger than that which can be stored in the data type (e.g. adding 1 to an <a class='wikilink' href='Int.html'>int</a> with the value 32,767 gives -32,768). If the operands are of different types, the "larger" type is used for the calculation.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>If one of the numbers (operands) are of the type <strong>float</strong> or of type <strong>double</strong>, floating point math will be used for the calculation.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Examples</h4>
|
|
||||||
<pre>
|
|
||||||
y = y + 3;
|
|
||||||
x = x - 7;
|
|
||||||
i = j * 6;
|
|
||||||
r = r / 5;
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<pre>
|
|
||||||
result = value1 + value2;
|
|
||||||
result = value1 - value2;
|
|
||||||
result = value1 * value2;
|
|
||||||
result = value1 / value2;
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Parameters:</h4>
|
|
||||||
<p>value1: any variable or constant
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>value2: any variable or constant
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Programming Tips:</h4>
|
|
||||||
<ul><li>Know that <a class='wikilink' href='IntegerConstants.html'>integer constants</a> default to <a class='wikilink' href='Int.html'>int</a>, so some constant calculations may overflow (e.g. 60 * 1000 will yield a negative result).
|
|
||||||
<p class='vspace'></p></li><li>Choose variable sizes that are large enough to hold the largest results from your calculations
|
|
||||||
<p class='vspace'></p></li><li>Know at what point your variable will "roll over" and also what happens in the other direction e.g. (0 - 1) OR (0 - - 32768)
|
|
||||||
<p class='vspace'></p></li><li>For math that requires fractions, use float variables, but be aware of their drawbacks: large size, slow computation speeds
|
|
||||||
<p class='vspace'></p></li><li>Use the cast operator e.g. (int)myFloat to convert one variable type to another on the fly.
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,86 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Assignment </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>= assignment operator (single equal sign)</h2>
|
|
||||||
<p>Stores the value to the right of the equal sign in the variable to the left of the equal sign.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The single equal sign in the C programming language is called the assignment operator. It has a different meaning than in algebra class where it indicated an equation or equality. The assignment operator tells the microcontroller to evaluate whatever value or expression is on the right side of the equal sign, and store it in the variable to the left of the equal sign.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre> int sensVal; // declare an integer variable named sensVal
|
|
||||||
senVal = analogRead(0); // store the (digitized) input voltage at analog pin 0 in <span class='wikiword'>SensVal</span>
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Programming Tips</h4>
|
|
||||||
<p>The variable on the left side of the assignment operator ( = sign ) needs to be able to hold the value stored in it. If it is not large enough to hold a value, the value stored in the variable will be incorrect.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Don't confuse the assignment operator [ = ] (single equal sign) with the comparison operator [ == ] (double equal signs), which evaluates whether two expressions are equal.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See Also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='If.html'>if (comparison operators)</a>
|
|
||||||
</li><li><a class='wikilink' href='Char.html'>char</a>
|
|
||||||
</li><li><a class='wikilink' href='Int.html'>int</a>
|
|
||||||
</li><li><a class='wikilink' href='Long.html'>long</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,115 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - AttachInterrupt </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>attachInterrupt(interrupt, function, mode)</h2>
|
|
||||||
<p class='vspace'></p><h4>Description</h4>
|
|
||||||
<p>Specifies a function to call when an external interrupt occurs. Replaces any previous function that was attached to the interrupt. Most Arduino boards have two external interrupts: numbers 0 (on digital pin 2) and 1 (on digital pin 3). The Arduino Mega has an additional four: numbers 2 (pin 21), 3 (pin 20), 4 (pin 19), and 5 (pin 18).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p><strong>interrupt</strong>: the number of the interrupt (<em>int</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><strong>function</strong>: the function to call when the interrupt occurs; this function must take no parameters and return nothing. This function is sometimes referred to as an <em>interrupt service routine.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><strong>mode</strong> defines when the interrupt should be triggered. Four contstants are predefined as valid values:
|
|
||||||
</p><ul><li><strong>LOW</strong> to trigger the interrupt whenever the pin is low,
|
|
||||||
</li><li><strong>CHANGE</strong> to trigger the interrupt whenever the pin changes value
|
|
||||||
</li><li><strong>RISING</strong> to trigger when the pin goes from low to high,
|
|
||||||
</li><li><strong>FALLING</strong> for when the pin goes from high to low.
|
|
||||||
</li></ul><p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Note</h4>
|
|
||||||
<p><em>Inside the attached function, delay() won't work and the value returned by millis() will not increment. Serial data received while in the function may be lost. You should declare as volatile any variables that you modify within the attached function.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Using Interrupts</h4>
|
|
||||||
<p>Interrupts are useful for making things happen automatically in microcontroller programs, and can help solve timing problems. A good task for using an interrupt might be reading a rotary encoder, monitoring user input.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>If you wanted to insure that a program always caught the pulses from a rotary encoder, never missing a pulse, it would make it very tricky to write a program to do anything else, because the program would need to constantly poll the sensor lines for the encoder, in order to catch pulses when they occurred. Other sensors have a similar interface dynamic too, such as trying to read a sound sensor that is trying to catch a click, or an infrared slot sensor (photo-interrupter) trying to catch a coin drop. In all of these situations, using an interrupt can free the microcontroller to get some other work done while not missing the doorbell.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>int pin = 13;
|
|
||||||
volatile int state = LOW;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
pinMode(pin, OUTPUT);
|
|
||||||
attachInterrupt(0, blink, CHANGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
digitalWrite(pin, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void blink()
|
|
||||||
{
|
|
||||||
state = !state;
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='DetachInterrupt.html'>detachInterrupt</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,85 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Bit </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>bit()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Computes the value of the specified bit (bit 0 is 1, bit 1 is 2, bit 2 is 4, etc.).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>bit(n)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>n: the bit whose value to compute
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>the value of the bit
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='BitRead.html'>bitRead</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitWrite.html'>bitWrite</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitSet.html'>bitSet</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitClear.html'>bitClear</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,87 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - BitClear </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>bitClear()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Clears (writes a 0 to) a bit of a numeric variable.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>bitClear(x, n)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: the numeric variable whose bit to clear
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>n: which bit to clear, starting at 0 for the least-significant (rightmost) bit
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Bit.html'>bit</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitRead.html'>bitRead</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitWrite.html'>bitWrite</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitSet.html'>bitSet</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,87 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - BitRead </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>bitRead()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Reads a bit of a number.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>bitRead(x, n)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: the number from which to read
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>n: which bit to read, starting at 0 for the least-significant (rightmost) bit
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>the value of the bit (0 or 1).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Bit.html'>bit</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitWrite.html'>bitWrite</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitSet.html'>bitSet</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitClear.html'>bitClear</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,87 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - BitSet </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>bitSet()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Sets (writes a 1 to) a bit of a numeric variable.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>bitSet(x, n)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: the numeric variable whose bit to set
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>n: which bit to set, starting at 0 for the least-significant (rightmost) bit
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Bit.html'>bit</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitRead.html'>bitRead</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitWrite.html'>bitWrite</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitClear.html'>bitClear</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,89 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - BitWrite </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>bitWrite()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Writes a bit of a numeric variable.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>bitWrite(x, n, b)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: the numeric variable to which to write
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>n: which bit of the number to write, starting at 0 for the least-significant (rightmost) bit
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>b: the value to write to the bit (0 or 1)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Bit.html'>bit</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitRead.html'>bitRead</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitSet.html'>bitSet</a>()
|
|
||||||
</li><li><a class='wikilink' href='BitClear.html'>bitClear</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,84 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - BitwiseXorNot </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Bitwise NOT (~)</h2>
|
|
||||||
<p>The bitwise NOT operator in C++ is the tilde character ~. Unlike & and |, the bitwise NOT operator is applied to a single operand to its right. Bitwise NOT changes each bit to its opposite: 0 becomes 1, and 1 becomes 0. For example:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre> 0 1 operand1
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><pre> ----------
|
|
||||||
1 0 ~ operand1
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><pre> int a = 103; // binary: 0000000001100111
|
|
||||||
int b = ~a; // binary: 1111111110011000 = -104
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p>You might be surprised to see a negative number like -104 as the result of this operation. This is because the highest bit in an int variable is the so-called sign bit. If the highest bit is 1, the number is interpreted as negative. This encoding of positive and negative numbers is referred to as two's complement. For more information, see the Wikipedia article on <a class='urllink' href='http://en.wikipedia.org/wiki/Twos_complement' rel='nofollow'>two's complement.</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>As an aside, it is interesting to note that for any integer x, ~x is the same as -x-1.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>At times, the sign bit in a signed integer expression can cause some unwanted surprises.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,111 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Boolean </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h1>Boolean Operators </h1>
|
|
||||||
<p>These can be used inside the condition of an <a class='wikilink' href='If.html'>if</a> statement.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>&& (logical and)</h3>
|
|
||||||
<p>True only if both operands are true, e.g.
|
|
||||||
</p><pre>
|
|
||||||
if (digitalRead(2) == HIGH && digitalRead(3) == HIGH) { // read two switches
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
</pre><p>is true only if both inputs are high.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>|| (logical or)</h3>
|
|
||||||
<p>True if either operand is true, e.g.
|
|
||||||
</p><pre>
|
|
||||||
if (x > 0 || y > 0) {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
</pre><p>is true if either x or y is greater than 0.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>! (not)</h3>
|
|
||||||
<p>True if the operand is false, e.g.
|
|
||||||
</p><pre>
|
|
||||||
if (!x) {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
</pre><p>is true if x is false (i.e. if x equals 0).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Warning</h4>
|
|
||||||
<p>Make sure you don't mistake the boolean AND operator, && (double ampersand) for the bitwise AND operator & (single ampersand). They are entirely different beasts.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Similarly, do not confuse the boolean || (double pipe) operator with the bitwise OR operator | (single pipe).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The bitwise not ~ (tilde) looks much different than the boolean not ! (exclamation point or "bang" as the programmers say) but you still have to be sure which one you want where.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Examples</h4>
|
|
||||||
<pre>
|
|
||||||
if (a >= 10 && a <= 20){} // true if a is between 10 and 20
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='BitwiseAnd.html'>&</a> (bitwise AND)
|
|
||||||
</li><li><a class='wikilink' href='BitwiseAnd.html'>|</a> (bitwise OR)
|
|
||||||
</li><li><a class='wikilink' href='BitwiseXorNot.html'>~</a> (bitwise NOT
|
|
||||||
</li><li><a class='wikilink' href='If.html'>if</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,102 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - BooleanVariables </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>boolean</h2>
|
|
||||||
<p>A <strong>boolean</strong> holds one of two values, <a class='wikilink' href='Constants.html'>true</a> or <a class='wikilink' href='Constants.html'>false</a>. (Each boolean variable occupies one byte of memory.)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
int LEDpin = 5; // LED on pin 5
|
|
||||||
int switchPin = 13; // momentary switch on 13, other side connected to ground
|
|
||||||
|
|
||||||
boolean running = false;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
pinMode(LEDpin, OUTPUT);
|
|
||||||
pinMode(switchPin, INPUT);
|
|
||||||
digitalWrite(switchPin, HIGH); // turn on pullup resistor
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
if (digitalRead(switchPin) == LOW)
|
|
||||||
{ // switch is pressed - pullup keeps pin high normally
|
|
||||||
delay(100); // delay to debounce switch
|
|
||||||
running = !running; // toggle running variable
|
|
||||||
digitalWrite(LEDpin, running) // indicate via LED
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Constants.html'>constants</a>
|
|
||||||
</li><li><a class='wikilink' href='Boolean.html'>boolean operators</a>
|
|
||||||
</li><li><a class='urllink' href='VariableDeclaration.html' rel='nofollow'>Variable Declaration</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,119 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Braces </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>{} Curly Braces</h2>
|
|
||||||
<p>Curly braces (also referred to as just "braces" or as "curly brackets") are a major part of the C programming language. They are used in several different constructs, outlined below, and this can sometimes be confusing for beginners.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>An opening curly brace "{" must always be followed by a closing curly brace "}". This is a condition that is often referred to as the braces being balanced. The Arduino IDE (integrated development environment) includes a convenient feature to check the balance of curly braces. Just select a brace, or even click the insertion point immediately following a brace, and its logical companion will be highlighted.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>At present this feature is slightly buggy as the IDE will often find (incorrectly) a brace in text that has been "commented out."
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Beginning programmers, and programmers coming to C from the BASIC language often find using braces confusing or daunting. After all, the same curly braces replace the RETURN statement in a subroutine (function), the ENDIF statement in a conditional and the NEXT statement in a FOR loop.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Because the use of the curly brace is so varied, it is good programming practice to type the closing brace immediately after typing the opening brace when inserting a construct which requires curly braces. Then insert some carriage returns between your braces and begin inserting statements. Your braces, and your attitude, will never become unbalanced.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages, braces are also incredibly important to the syntax of a program and moving a brace one or two lines will often dramatically affect the meaning of a program.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4><strong>The main uses of curly braces</strong></h4>
|
|
||||||
<h4>Functions</h4>
|
|
||||||
<pre> void myfunction(datatype argument){
|
|
||||||
statements(s)
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Loops</h4>
|
|
||||||
<pre> while (boolean expression)
|
|
||||||
{
|
|
||||||
statement(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
statement(s)
|
|
||||||
} while (boolean expression);
|
|
||||||
|
|
||||||
for (initialisation; termination condition; incrementing expr)
|
|
||||||
{
|
|
||||||
statement(s)
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Conditional statements</h4>
|
|
||||||
<p class='vspace'></p><pre> if (boolean expression)
|
|
||||||
{
|
|
||||||
statement(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boolean expression)
|
|
||||||
{
|
|
||||||
statement(s)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
statement(s)
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,85 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Break </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>break</h2>
|
|
||||||
<p><strong>break</strong> is used to exit from a <strong>do</strong>, <strong>for</strong>, or <strong>while</strong> loop, bypassing the normal loop condition. It is also used to exit from a <strong>switch</strong> statement.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
for (x = 0; x < 255; x ++)
|
|
||||||
{
|
|
||||||
digitalWrite(PWMpin, x);
|
|
||||||
sens = analogRead(sensorPin);
|
|
||||||
if (sens > threshold){ // bail out on sensor detect
|
|
||||||
x = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
delay(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,78 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Byte </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>byte</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>A byte stores an 8-bit unsigned number, from 0 to 255.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre> byte b = B10010; // "B" is the binary formatter (B10010 = 18 decimal)
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Word.html'>word</a>
|
|
||||||
</li><li><a class='wikilink' href='ByteCast.html'>byte</a>()
|
|
||||||
</li><li><a class='urllink' href='VariableDeclaration.html' rel='nofollow'>Variable Declaration</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,82 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ByteCast </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>byte()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Converts a value to the <a class='wikilink' href='Byte.html'>byte</a> data type.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>byte(x)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: a value of any type
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>byte
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Byte.html'>byte</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,89 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Changes </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='selflink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Changes</h2>
|
|
||||||
<p>This page lists major changes to the Arduino core, libraries, and environment. For details, see the <a class='wikilink' href='http://arduino.cc/en/Main/ReleaseNotes'>release notes</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>Changes in Arduino 0017</h3>
|
|
||||||
<ul><li><strong>Environment</strong>: The code base for the Arduino development environment was largely re-written to bring it back into sync with Processing (1.0.3). The main differences include support for multiple sketch windows open simultaneously and a dedicated window for the serial monitor.
|
|
||||||
<p class='vspace'></p></li><li><strong>Icons</strong>: The icons and about images were updated.
|
|
||||||
<p class='vspace'></p></li><li><strong>Arduino.app</strong>: The Mac OS X version of Arduino is now a .app file packaged in a .dmg.
|
|
||||||
<p class='vspace'></p></li><li><strong>Libraries</strong>: Support was added for third-party libraries in the <em>SKETCHBOOK</em>/libraries directory. This allows user-installed libraries to persist across upgrades of the Arduino software.
|
|
||||||
<p class='vspace'></p></li><li><strong>Servo</strong>: The servo library was rewritten to allow support for up to 12 servos (on any pins) and up to 48 on the Mega.
|
|
||||||
<p class='vspace'></p></li><li><strong><span class='wikiword'>LiquidCrystal</span></strong>: The begin(), cursor(), noCursor(), blink(), noBlink(), display(), noDisplay(), scrollDisplayLeft(), scrollDisplayRight(), autoscroll(), noAutoscroll(), leftToRight(), rightToLeft(), and createChar() functions were added.
|
|
||||||
</li></ul><p class='vspace'></p><h3>Changes in Arduino 0016</h3>
|
|
||||||
<ul><li>New functions for writing a string, write(str), or buffer, write(buf, len), were added to the Print, Serial, and Ethernet library Client and Server classes.
|
|
||||||
</li></ul><p class='vspace'></p><h3>Changes in Arduino 0015</h3>
|
|
||||||
<ul><li>Support for the Arduino Mega.
|
|
||||||
</li></ul><p class='vspace'></p><h3>Changes in Arduino 0013</h3>
|
|
||||||
<ul><li>Support for printing floats was added to the Print, Serial, and Ethernet library Client and Server classes.
|
|
||||||
<p class='vspace'></p></li><li>The word type and word(), bitRead(), bitWrite(), bitSet(), bitClear(), bit(), lowByte(), and highByte() functions were added.
|
|
||||||
</li></ul><p class='vspace'></p><h3>Changes in Arduino 0012</h3>
|
|
||||||
<ul><li>Added the Firmata library, which provides a standard protocol for serial communication.
|
|
||||||
<p class='vspace'></p></li><li>Added Ethernet library.
|
|
||||||
<p class='vspace'></p></li><li>Added Servo library.
|
|
||||||
<p class='vspace'></p></li><li>Added <span class='wikiword'>LiquidCrystal</span> library.
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,85 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Char </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>char</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>A data type that takes up 1 byte of memory that stores a character value. Character literals are written in single quotes, like this: 'A' (for multiple characters - strings - use double quotes: "ABC").
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Characters are stored as numbers however. You can see the specific encoding in the <a class='wikilink' href='ASCIIchart.html'>ASCII chart</a>. This means that it is possible to do arithmetic on characters, in which the ASCII value of the character is used (e.g. 'A' + 1 has the value 66, since the ASCII value of the capital letter A is 65). See <a class='wikilink' href='Serial_Println.html'>Serial.println</a> reference for more on how characters are translated to numbers.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The char datatype is a signed type, meaning that it encodes numbers from -128 to 127. For an unsigned, one-byte (8 bit) data type, use the <em>byte</em> data type.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre> char myChar = 'A';
|
|
||||||
char myChar = 65; // both are equivalent
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Byte.html'>byte</a>
|
|
||||||
</li><li><a class='wikilink' href='Int.html'>int</a>
|
|
||||||
</li><li><a class='wikilink' href='Array.html'>array</a>
|
|
||||||
</li><li><a class='wikilink' href='Serial_Println.html'>Serial.println</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,82 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - CharCast </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>char()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Converts a value to the <a class='wikilink' href='Char.html'>char</a> data type.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>char(x)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: a value of any type
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>char
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Char.html'>char</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,126 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientAvailable </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>available()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Returns the number of bytes available for reading (that is, the amount of data that has been written to the client by the server it is connected to).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.available()
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>The number of bytes available.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>
|
|
||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|
||||||
byte ip[] = { 10, 0, 0, 177 };
|
|
||||||
byte server[] = { 64, 233, 187, 99 }; // Google
|
|
||||||
|
|
||||||
Client client(server, 80);
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Ethernet.begin(mac, ip);
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
Serial.println("connecting...");
|
|
||||||
|
|
||||||
if (client.connect()) {
|
|
||||||
Serial.println("connected");
|
|
||||||
client.println("GET /search?q=arduino HTTP/1.0");
|
|
||||||
client.println();
|
|
||||||
} else {
|
|
||||||
Serial.println("connection failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
if (client.available()) {
|
|
||||||
char c = client.read();
|
|
||||||
Serial.print(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!client.connected()) {
|
|
||||||
Serial.println();
|
|
||||||
Serial.println("disconnecting.");
|
|
||||||
client.stop();
|
|
||||||
for(;;)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,127 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientConnect </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>connect()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Connect to the IP address and port specified in the constructor. The return value indicates success or failure.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.connect()
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>Returns true if the connection succeeds, false if not.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|
||||||
byte ip[] = { 10, 0, 0, 177 };
|
|
||||||
byte server[] = { 64, 233, 187, 99 }; // Google
|
|
||||||
|
|
||||||
Client client(server, 80);
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Ethernet.begin(mac, ip);
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
Serial.println("connecting...");
|
|
||||||
|
|
||||||
if (client.connect()) {
|
|
||||||
Serial.println("connected");
|
|
||||||
client.println("GET /search?q=arduino HTTP/1.0");
|
|
||||||
client.println();
|
|
||||||
} else {
|
|
||||||
Serial.println("connection failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
if (client.available()) {
|
|
||||||
char c = client.read();
|
|
||||||
Serial.print(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!client.connected()) {
|
|
||||||
Serial.println();
|
|
||||||
Serial.println("disconnecting.");
|
|
||||||
client.stop();
|
|
||||||
for(;;)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,127 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientConnected </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>connected()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Whether or not the client is connected. Note that a client is considered connected if the connection has been closed but there is still unread data.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.connected()
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>Returns true if the client is connected, false if not.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|
||||||
byte ip[] = { 10, 0, 0, 177 };
|
|
||||||
byte server[] = { 64, 233, 187, 99 }; // Google
|
|
||||||
|
|
||||||
Client client(server, 80);
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Ethernet.begin(mac, ip);
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
Serial.println("connecting...");
|
|
||||||
|
|
||||||
if (client.connect()) {
|
|
||||||
Serial.println("connected");
|
|
||||||
client.println("GET /search?q=arduino HTTP/1.0");
|
|
||||||
client.println();
|
|
||||||
} else {
|
|
||||||
Serial.println("connection failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
if (client.available()) {
|
|
||||||
char c = client.read();
|
|
||||||
Serial.print(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!client.connected()) {
|
|
||||||
Serial.println();
|
|
||||||
Serial.println("disconnecting.");
|
|
||||||
client.stop();
|
|
||||||
for(;;)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,126 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientConstructor </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Client()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Creates a client which can connect to the specified internet IP address and port.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>Client(ip, port)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>ip: the IP address that the client will connect to (array of 4 bytes)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>port: the port that the client will connect to (int)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|
||||||
byte ip[] = { 10, 0, 0, 177 };
|
|
||||||
byte server[] = { 64, 233, 187, 99 }; // Google
|
|
||||||
|
|
||||||
Client client(server, 80);
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Ethernet.begin(mac, ip);
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
Serial.println("connecting...");
|
|
||||||
|
|
||||||
if (client.connect()) {
|
|
||||||
Serial.println("connected");
|
|
||||||
client.println("GET /search?q=arduino HTTP/1.0");
|
|
||||||
client.println();
|
|
||||||
} else {
|
|
||||||
Serial.println("connection failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
if (client.available()) {
|
|
||||||
char c = client.read();
|
|
||||||
Serial.print(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!client.connected()) {
|
|
||||||
Serial.println();
|
|
||||||
Serial.println("disconnecting.");
|
|
||||||
client.stop();
|
|
||||||
for(;;)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,81 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientFlush </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>flush()</h2>
|
|
||||||
<p>Discard any bytes that have been written to the client but not yet read.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.flush()
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,85 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientPrint </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>print()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Print data to the server that a client is connected to. Prints numbers as a sequence of digits, each an ASCII character (e.g. the number 123 is sent as the three characters '1', '2', '3').
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.print(data) <br /><em>client</em>.print(data, BASE)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>data: the data to print (char, byte, int, long, or string)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,85 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientPrintln </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>println()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Print data, followed by a newline, to the server a client is connected to. Prints numbers as a sequence of digits, each an ASCII character (e.g. the number 123 is sent as the three characters '1', '2', '3').
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.println() <br /><em>client</em>.println(data) <br /><em>client</em>.print(data, BASE)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>data (optional): the data to print (char, byte, int, long, or string)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,81 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientRead </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>read()</h2>
|
|
||||||
<p>Read the next byte received from the server the client is connected to (after the last call to read()).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.read()
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>The next byte (or character), or -1 if none is available.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,82 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientStop </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>stop()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Disconnect from the server.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.stop()
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,80 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ClientWrite </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a> : <em>Client</em> class
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>write()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Write data to the server the client is connected to.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><em>client</em>.write(data)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>data: the byte or char to write
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,88 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Comments </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Comments</h2>
|
|
||||||
<p>Comments are lines in the program that are used to inform yourself or others about the way the program works. They are ignored by the compiler, and not exported to the processor, so they don't take up any space on the Atmega chip.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Comments only purpose are to help you understand (or remember) how your program works or to inform others how your program works.
|
|
||||||
There are two different ways of marking a line as a comment:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre> x = 5; // This is a single line comment. Anything after the slashes is a comment
|
|
||||||
// to the end of the line
|
|
||||||
|
|
||||||
/* this is multiline comment - use it to comment out whole blocks of code
|
|
||||||
|
|
||||||
if (gwb == 0){ // single line comment is OK inside a multiline comment
|
|
||||||
x = 3; /* but not another multiline comment - this is invalid */
|
|
||||||
}
|
|
||||||
// don't forget the "closing" comment - they have to be balanced!
|
|
||||||
*/
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><strong>Tip</strong><br />When experimenting with code, "commenting out" parts of your program is a convenient way to remove lines that may be buggy. This leaves the lines in the code, but turns them into comments, so the compiler just ignores them. This can be especially useful when trying to locate a problem, or when a program refuses to compile and the compiler error is cryptic or unhelpful.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,94 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Comparison </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='selflink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Arduino/Processing Language Comparison</h2>
|
|
||||||
<p>The Arduino language (based on Wiring) is implemented in C/C++, and therefore has some differences from the Processing language, which is based on Java.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>Arrays</h3>
|
|
||||||
<table width='75%' cellspacing='0' cellpadding='5'><tr><td width='50%' bgcolor='#999999' valign='top'> <em>Arduino</em>
|
|
||||||
</td><td width='50%' bgcolor='#CCCCCC' valign='top'> <em>Processing</em>
|
|
||||||
</td></tr><tr><td valign='top'> int bar[8]; <br clear='all' /> bar[0] = 1;
|
|
||||||
</td><td valign='top'> int[] bar = new int[8]; <br clear='all' /> bar[0] = 1;
|
|
||||||
</td></tr><tr><td bgcolor='#999999' valign='top'> int foo[] = { 0, 1, 2 };
|
|
||||||
</td><td bgcolor='#CCCCCC' valign='top'> int foo[] = { 0, 1, 2 }; <br clear='all' /> <em>or</em> <br clear='all' /> int[] foo = { 0, 1, 2 };
|
|
||||||
</td></tr></table>
|
|
||||||
<p class='vspace'></p><h3>Loops</h3>
|
|
||||||
<table width='75%' cellspacing='0' cellpadding='5'><tr><td width='50%' bgcolor='#999999' valign='top'> <em>Arduino</em>
|
|
||||||
</td><td width='50%' bgcolor='#CCCCCC' valign='top'> <em>Processing</em>
|
|
||||||
</td></tr><tr><td valign='top'> int i; <br clear='all' /> for (i = 0; i < 5; i++) { ... }
|
|
||||||
</td><td valign='top'> for (int i = 0; i < 5; i++) { ... }
|
|
||||||
</td></tr></table>
|
|
||||||
<p class='vspace'></p><h3>Printing</h3>
|
|
||||||
<table width='75%' cellspacing='0' cellpadding='5'><tr><td width='50%' bgcolor='#999999' valign='top'> <em>Arduino</em>
|
|
||||||
</td><td width='50%' bgcolor='#CCCCCC' valign='top'> <em>Processing</em>
|
|
||||||
</td></tr><tr><td valign='top'> Serial.println("hello world");
|
|
||||||
</td><td valign='top'> println("hello world");
|
|
||||||
</td></tr><tr><td bgcolor='#999999' valign='top'> int i = 5; <br clear='all' /> Serial.println(i);
|
|
||||||
</td><td bgcolor='#CCCCCC' valign='top'> int i = 5; <br clear='all' /> println(i);
|
|
||||||
</td></tr><tr><td valign='top'> int i = 5; <br clear='all' /> Serial.print("i = "); <br clear='all' /> Serial.print(i); <br clear='all' /> Serial.println();
|
|
||||||
</td><td valign='top'> int i = 5; <br clear='all' /> println("i = " + i);
|
|
||||||
</td></tr></table>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,90 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Const </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>const keyword</h2>
|
|
||||||
<p>The <strong>const</strong> keyword stands for constant. It is a variable <em>qualifier</em> that modifies the behavior of the variable, making a variable "<em>read-only</em>". This means that the variable can be used just as any other variable of its type, but its value cannot be changed. You will get a compiler error if you try to assign a value to a <strong>const</strong> variable.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Constants defined with the <em>const</em> keyword obey the rules of <em><a class='wikilink' href='Scope.html'>variable scoping</a></em> that govern other variables. This, and the pitfalls of using<em>#define</em>, makes the <em>const</em> keyword a superior method for defining constants and is preferred over using <em><a class='wikilink' href='Define.html'>#define</a></em>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
const float pi = 3.14;
|
|
||||||
float x;
|
|
||||||
|
|
||||||
// ....
|
|
||||||
|
|
||||||
x = pi * 2; // it's fine to use const's in math
|
|
||||||
|
|
||||||
pi = 7; // illegal - you can't write to (modify) a constant
|
|
||||||
|
|
||||||
|
|
||||||
</pre><h4><strong>#define</strong> or <strong>const</strong></h4>
|
|
||||||
<p>You can use either <strong>const</strong> or <strong>#define</strong> for creating numeric or string constants. For <a class='wikilink' href='Array.html'>arrays</a>, you will need to use <strong>const</strong>. In general <em>const</em> is preferred over <em>#define</em> for defining constants.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>See also:
|
|
||||||
</p><ul><li><a class='wikilink' href='Define.html'>#define</a>
|
|
||||||
</li><li><a class='wikilink' href='Volatile.html'>volatile</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,92 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Constrain </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>constrain(x, a, b)</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Constrains a number to be within a range.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: the number to constrain, all data types
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>a: the lower end of the range, all data types
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>b: the upper end of the range, all data types
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p><strong>x</strong>: if <strong>x</strong> is between <strong>a</strong> and <strong>b</strong>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><strong>a</strong>: if <strong>x</strong> is less than <strong>a</strong>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><strong>b</strong>: if <strong>x</strong> is greater than <strong>b</strong>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>sensVal = constrain(sensVal, 10, 150);
|
|
||||||
// limits range of sensor values to between 10 and 150
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Min.html'>min</a>()
|
|
||||||
</li><li><a class='wikilink' href='Max.html'>max</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,84 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Continue </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>continue</h2>
|
|
||||||
<p>The continue statement skips the rest of the current iteration of a loop (<strong>do</strong>, <strong>for</strong>, or <strong>while</strong>). It continues by checking the conditional expression of the loop, and proceeding with any subsequent iterations.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
|
|
||||||
for (x = 0; x < 255; x ++)
|
|
||||||
{
|
|
||||||
if (x > 40 && x < 120){ // create jump in values
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
digitalWrite(PWMpin, x);
|
|
||||||
delay(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,84 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Cos </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>cos(rad)</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Calculates the cos of an angle (in radians). The result will be between -1 and 1.<br />
|
|
||||||
</p><h4>Parameters</h4>
|
|
||||||
<p>rad: the angle in radians (<em>float</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>The cos of the angle ("double")
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Note</h4>
|
|
||||||
<p>Serial.print() and Serial.println() do not currently support printing floats.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Sin.html'>sin</a>()
|
|
||||||
</li><li><a class='wikilink' href='Tan.html'>tan</a>()
|
|
||||||
</li><li><a class='wikilink' href='Float.html'>float</a>
|
|
||||||
</li><li><a class='wikilink' href='Double.html'>double</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,99 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Define </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Define</h2>
|
|
||||||
<p><code>#define</code> is a useful C component that allows the programmer to give a name to a constant value before the program is compiled. Defined constants in arduino don't take up any program memory space on the chip. The compiler will replace references to these constants with the defined value at compile time.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>This can have some unwanted side effects though, if for example, a constant name that had been #defined is included in some other constant or variable name. In that case the text would be replaced by the #defined number (or text).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>In general, the <em><a class='wikilink' href='Const.html'>const</a></em> keyword is preferred for defining constants and should be used instead of #define.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Arduino defines have the same syntax as C defines:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p><code>#define constantName value</code>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Note that the # is necessary.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>#define ledPin 3
|
|
||||||
// The compiler will replace any mention of ledPin with the value 3 at compile time.
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Tip</h4>
|
|
||||||
<p>There is no semicolon after the #define statement. If you include one, the compiler will throw cryptic errors further down the page.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>#define ledPin 3; // this is an error
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p>Similarly, including an equal sign after the #define statement will also generate a cryptic compiler error further down the page.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>#define ledPin = 3 // this is also an error
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Const.html'>const</a>
|
|
||||||
</li><li><a class='wikilink' href='IntegerConstants.html'>Constants</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,108 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Delay </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>delay()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Pauses the program for the amount of time (in miliseconds) specified as parameter. (There are 1000 milliseconds in a second.)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>delay(ms)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>ms: the number of milliseconds to pause (<em>unsigned long</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>nothing
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
int ledPin = 13; // LED connected to digital pin 13
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
pinMode(ledPin, OUTPUT); // sets the digital pin as output
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
digitalWrite(ledPin, HIGH); // sets the LED on
|
|
||||||
delay(1000); // waits for a second
|
|
||||||
digitalWrite(ledPin, LOW); // sets the LED off
|
|
||||||
delay(1000); // waits for a second
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Caveat</h4>
|
|
||||||
<p>While it is easy to create a blinking LED with the delay() function, and many sketches use short delays for such tasks as switch debouncing, the use of delay() in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the <a class='wikilink' href='Millis.html'>millis()</a> function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay() for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Certain things <em>do</em> go on while the delay() function is controlling the Atmega chip however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (<a class='wikilink' href='AnalogWrite.html'>analogWrite</a>) values and pin states are maintained, and <a class='wikilink' href='AttachInterrupt.html'>interrupts</a> will work as they should.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Millis.html'>millis</a>()
|
|
||||||
</li><li><a class='wikilink' href='Micros.html'>micros</a>()
|
|
||||||
</li><li><a class='wikilink' href='DelayMicroseconds.html'>delayMicroseconds</a>()
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/BlinkWithoutDelay'>Blink Without Delay</a> example
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,110 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - DelayMicroseconds </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>delayMicroseconds()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Pauses the program for the amount of time (in microseconds) specified as parameter. There are a thousand microseconds in a millisecond, and a million microseconds in a second.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Currently, the largest value that will produce an accurate delay is 16383. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use delay() instead.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>us: the number of microseconds to pause (<em>unsigned int</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>None
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
int outPin = 8; // digital pin 8
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
pinMode(outPin, OUTPUT); // sets the digital pin as output
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
digitalWrite(outPin, HIGH); // sets the pin on
|
|
||||||
delayMicroseconds(50); // pauses for 50 microseconds
|
|
||||||
digitalWrite(outPin, LOW); // sets the pin off
|
|
||||||
delayMicroseconds(50); // pauses for 50 microseconds
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p>configures pin number 8 to work as an output pin. It sends a train of pulses with 100 microseconds period.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Caveats and Known Issues</h4>
|
|
||||||
<p>This function works very accurately in the range 3 microseconds and up. We cannot assure that delayMicroseconds will perform precisely for smaller delay-times.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>To ensure more accurate delays, this functions disables interrupts during its operation, meaning that some things (like receiving serial data, or incrementing the value returned by millis()) will not happen during the delay. Thus, you should only use this function for short delays, and use delay() for longer ones.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>delayMicroseconds(0) will generate a much longer delay than expected (~1020 us) as will using negative numbers as a parameter.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Millis.html'>millis</a>()
|
|
||||||
</li><li><a class='wikilink' href='Micros.html'>micros</a>()
|
|
||||||
</li><li><a class='wikilink' href='Delay.html'>delay</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,76 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - DetachInterrupt </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>detachInterrupt(interrupt)</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Turns off the given interrupt.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>interrupt: the number of interrupt to disable (0 or 1).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='AttachInterrupt.html'>attachInterrupt</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,110 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - DigitalRead </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>digitalRead()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Reads the value from a specified digital pin, either <a class='wikilink' href='Constants.html'>HIGH</a> or <a class='wikilink' href='Constants.html'>LOW</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>digitalRead(pin)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>pin: the number of the digital pin you want to read (<em>int</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p><a class='wikilink' href='Constants.html'>HIGH</a> or <a class='wikilink' href='Constants.html'>LOW</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
int ledPin = 13; // LED connected to digital pin 13
|
|
||||||
int inPin = 7; // pushbutton connected to digital pin 7
|
|
||||||
int val = 0; // variable to store the read value
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
|
|
||||||
pinMode(inPin, INPUT); // sets the digital pin 7 as input
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
val = digitalRead(inPin); // read the input pin
|
|
||||||
digitalWrite(ledPin, val); // sets the LED to the button's value
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p>Sets pin 13 to the same value as the pin 7, which is an input.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Note</h4>
|
|
||||||
<p>If the pin isn't connected to anything, digitalRead() can return either HIGH or LOW (and this can change randomly).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='PinMode.html'>pinMode</a>()
|
|
||||||
</li><li><a class='wikilink' href='DigitalWrite.html'>digitalWrite</a>()
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/DigitalPins'>Tutorial: Digital Pins</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,113 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - DigitalWrite </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>digitalWrite()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Write a <a class='wikilink' href='Constants.html'>HIGH</a> or a <a class='wikilink' href='Constants.html'>LOW</a> value to a digital pin.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>If the pin has been configured as an OUTPUT with <a class='wikilink' href='PinMode.html'>pinMode</a>(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the <a class='wikilink' href='http://arduino.cc/en/Tutorial/DigitalPins'>tutorial on digital pins</a>). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if <span class='wikiword'>LEDs</span> appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>digitalWrite(pin, value)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>pin: the pin number
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>value: <a class='wikilink' href='Constants.html'>HIGH</a> or <a class='wikilink' href='Constants.html'>LOW</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
int ledPin = 13; // LED connected to digital pin 13
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
pinMode(ledPin, OUTPUT); // sets the digital pin as output
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
digitalWrite(ledPin, HIGH); // sets the LED on
|
|
||||||
delay(1000); // waits for a second
|
|
||||||
digitalWrite(ledPin, LOW); // sets the LED off
|
|
||||||
delay(1000); // waits for a second
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p>Sets pin 13 to HIGH, makes a one-second-long delay, and sets the pin back to LOW.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Note</h4>
|
|
||||||
<p>The analog input pins can also be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='PinMode.html'>pinMode</a>()
|
|
||||||
</li><li><a class='wikilink' href='DigitalRead.html'>digitalRead</a>()
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/DigitalPins'>Tutorial: Digital Pins</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,87 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - DoWhile </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>do - while</h2>
|
|
||||||
<p>The <strong>do</strong> loop works in the same manner as the <strong>while</strong> loop, with the exception that the condition is tested at the end of the loop, so the <strong>do</strong> loop will <em>always</em> run at least once.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// statement block
|
|
||||||
} while (test condition);
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
do
|
|
||||||
{
|
|
||||||
delay(50); // wait for sensors to stabilize
|
|
||||||
x = readSensors(); // check the sensors
|
|
||||||
|
|
||||||
} while (x < 100);
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,78 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Double </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>double</h2>
|
|
||||||
<h4>Desciption</h4>
|
|
||||||
<p>Double precision floating point number. Occupies 4 bytes.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The double implementation on the Arduino is currently exactly the same as the float, with no gain in precision.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Tip</h4>
|
|
||||||
<p>Users who borrow code from other sources that includes double variables may wish to examine the code to see if the implied precision is different from that actually achieved on the Arduino.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See:</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Float.html'>float</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,73 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - EEPROM </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>EEPROM Library</h2>
|
|
||||||
<p>The microcontroller on the Arduino board has 512 bytes of EEPROM: memory whose values are kept when the board is turned off (like a tiny hard drive). This library enables you to read and write those bytes.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Functions</h4>
|
|
||||||
<ul><li><a class='wikilink' href='EEPROMRead.html'>read()</a>
|
|
||||||
</li><li><a class='wikilink' href='EEPROMWrite.html'>write()</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,109 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - EEPROMRead </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>byte EEPROM.read(address)</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Reads a byte from the EEPROM. Locations that have never been written to have the value of 255.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>address: the location to read from, from 0 to 511 (<em>int</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>the value stored in that location (<em>byte</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
#include <EEPROM.h>
|
|
||||||
|
|
||||||
int a = 0;
|
|
||||||
int value;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
value = EEPROM.read(a);
|
|
||||||
|
|
||||||
Serial.print(a);
|
|
||||||
Serial.print("\t");
|
|
||||||
Serial.print(value);
|
|
||||||
Serial.println();
|
|
||||||
|
|
||||||
a = a + 1;
|
|
||||||
|
|
||||||
if (a == 512)
|
|
||||||
a = 0;
|
|
||||||
|
|
||||||
delay(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='EEPROMWrite.html'>EEPROM.write</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,102 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - EEPROMWrite </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>EEPROM.write(address, value)</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Write a byte to the EEPROM.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>address: the location to write to, from 0 to 511 (<em>int</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>value: the value to write, from 0 to 255 (<em>byte</em>)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>none
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The Atmega 168 datasheet says that EEPROM memory has a specified life of 100000 write/erase cycles, so there is a limit to how many times you can write information to that memory space. Keep this in mind for long-lived projects or fast-moving data.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The datasheet also specifies that a write cycle takes 3.3 ms to complete. Other EEPROM write and read requests will fail if executed in this time period. This delay appears to be built into the EEPROM library as a casual test shows each cycle taking 3.33 ms to execute.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Hence, you do not specifically need to add a delay to an EEPROM write, just be aware of the built-in time delay.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
#include <EEPROM.h>
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 512; i++)
|
|
||||||
EEPROM.write(i, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='EEPROMRead.html'>EEPROM.read</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,103 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Else </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>if / else</h2>
|
|
||||||
<p><strong>if/else</strong> allows greater control over the flow of code than the basic <strong>if</strong> statement, by allowing multiple tests to be grouped together. For example, an analog input could be tested and one action taken if the input was less than 500, and another action taken if the input was 500 or greater. The code would look like this:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>if (pinFiveInput < 500)
|
|
||||||
{
|
|
||||||
// action A
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// action B
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><strong>else</strong> can proceed another <strong>if</strong> test, so that multiple, mutually exclusive tests can be run at the same time.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Each test will proceed to the next one until a true test is encountered. When a true test is found, its associated block of code is run, and the program then skips to the line following the entire if/else construction. If no test proves to be true, the default <strong>else</strong> block is executed, if one is present, and sets the default behavior.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Note that an <strong>else if</strong> block may be used with or without a terminating <strong>else</strong> block and vice versa. An unlimited number of such <strong>else if</strong> branches is allowed.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>if (pinFiveInput < 500)
|
|
||||||
{
|
|
||||||
// do Thing A
|
|
||||||
}
|
|
||||||
else if (pinFiveInput >= 1000)
|
|
||||||
{
|
|
||||||
// do Thing B
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// do Thing C
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre><p>Another way to express branching, mutually exclusive tests, is with the <a class='wikilink' href='SwitchCase.html'>switch case</a> statement.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also:</h4>
|
|
||||||
<p><a class='wikilink' href='SwitchCase.html'>switch case</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,96 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Ethernet </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Ethernet library</h2>
|
|
||||||
<p>With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet. It can serve as either a server accepting incoming connections or a client making outgoing ones. The library supports up to four concurrent connection (incoming or outgoing or a combination).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Ethernet class</h4>
|
|
||||||
<p>The Ethernet class initializes the ethernet library and network settings.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ul><li><a class='wikilink' href='EthernetBegin.html'>begin()</a>
|
|
||||||
</li></ul><p class='vspace'></p><h4>Server class</h4>
|
|
||||||
<p>The Server class creates servers which can send data to and receive data from connected clients (programs running on other computers or devices).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ul><li><a class='wikilink' href='ServerConstructor.html'>Server()</a>
|
|
||||||
</li><li><a class='wikilink' href='ServerBegin.html'>begin()</a>
|
|
||||||
</li><li><a class='wikilink' href='ServerAvailable.html'>available()</a>
|
|
||||||
</li><li><a class='wikilink' href='ServerWrite.html'>write()</a>
|
|
||||||
</li><li><a class='wikilink' href='ServerPrint.html'>print()</a>
|
|
||||||
</li><li><a class='wikilink' href='ServerPrintln.html'>println()</a>
|
|
||||||
</li></ul><p class='vspace'></p><h4>Client class</h4>
|
|
||||||
<p>The client class creates clients that can connect to servers and send and receive data.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ul><li><a class='wikilink' href='ClientConstructor.html'>Client()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientConnected.html'>connected()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientConnect.html'>connect()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientWrite.html'>write()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientPrint.html'>print()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientPrintln.html'>println()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientAvailable.html'>available()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientRead.html'>read()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientFlush.html'>flush()</a>
|
|
||||||
</li><li><a class='wikilink' href='ClientStop.html'>stop()</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,102 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - EthernetBegin </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Ethernet.html'>Ethernet</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>Ethernet.begin()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Initializes the ethernet library and network settings.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>Ethernet.begin(mac, ip); <br />Ethernet.begin(mac, ip, gateway); <br />Ethernet.begin(mac, ip, gateway, subnet); <br />
|
|
||||||
</p><h4>Parameters</h4>
|
|
||||||
<p>mac: the MAC address for the device (array of 6 bytes)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>ip: the IP address of the device (array of 4 bytes)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>gateway: the IP address of the network gateway (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>subnet: the subnet mask of the network (array of 4 bytes). optional: defaults to 255.255.255.0
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>None
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
#include <Ethernet.h>
|
|
||||||
|
|
||||||
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|
||||||
byte ip[] = { 10, 0, 0, 177 };
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Ethernet.begin(mac, ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop () {}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,98 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Float </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>float</h2>
|
|
||||||
<h4>Description </h4>
|
|
||||||
<p>Datatype for floating-point numbers, a number that has a decimal point. Floating-point numbers are often used to approximate analog and continuous values because they have greater resolution than integers. Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of information.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Floating point numbers are not exact, and may yield strange results when compared. For example <code>6.0 / 3.0</code> may not equal <code>2.0</code>. You should instead check that the absolute value of the difference between the numbers is less than some small number.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Floating point math is also much slower than integer math in performing calculations, so should be avoided if, for example, a loop has to run at top speed for a critical timing function. Programmers often go to some lengths to convert floating point calculations to integer math to increase speed.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Examples</h4>
|
|
||||||
<pre> float myfloat;
|
|
||||||
float sensorCalbrate = 1.117;
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<pre> float var = val;
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><ul><li>var - your float variable name
|
|
||||||
</li><li>val - the value you assign to that variable
|
|
||||||
</li></ul><p class='vspace'></p><h4>Example Code</h4>
|
|
||||||
<pre>
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
float z;
|
|
||||||
|
|
||||||
x = 1;
|
|
||||||
y = x / 2; // y now contains 0, ints can't hold fractions
|
|
||||||
z = (float)x / 2.0; // z now contains .5 (you have to use 2.0, not 2)
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See Also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Int.html'>int</a>
|
|
||||||
</li><li><a class='wikilink' href='Double.html'>double</a>
|
|
||||||
</li><li><a class='urllink' href='VariableDeclaration.html' rel='nofollow'>Variable Declaration</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,82 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - FloatCast </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>float()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Converts a value to the <a class='wikilink' href='Float.html'>float</a> data type.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>float(x)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: a value of any type
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>float
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Float.html'>float</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,105 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - For </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>for statements</h2>
|
|
||||||
<h4>Desciption</h4>
|
|
||||||
<p>The <strong>for</strong> statement is used to repeat a block of statements enclosed in curly braces. An increment counter is usually used to increment and terminate the loop. The <strong>for</strong> statement is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of data/pins.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>There are three parts to the <strong>for</strong> loop header:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><code><strong>for</strong> (<strong>initialization</strong>;<strong> condition</strong>;<strong> increment</strong>) {</code>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><code> //statement(s);</code>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><code>}</code>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The <strong>initialization</strong> happens first and exactly once. Each time through the loop, the <strong>condition</strong> is tested; if it's true, the statement block, and the <strong>increment</strong> is executed, then the <strong>condition</strong> is tested again. When the <strong>condition</strong> becomes false, the loop ends.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
// Dim an LED using a PWM pin
|
|
||||||
int PWMpin = 10; // LED in series with 1k resistor on pin 10
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// no setup needed
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
for (int i=0; i <= 255; i++){
|
|
||||||
analogWrite(PWMpin, i);
|
|
||||||
delay(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Coding Tip</h4>
|
|
||||||
<p>The C <strong>for</strong> loop is much more flexible than <strong>for</strong> loops found in some other computer languages, including BASIC. Any or all of the three header elements may be omitted, although the semicolons are required. Also the statements for initialization, condition, and increment can be any valid C statements with unrelated variables. These types of unusual <strong>for</strong> statements may provide solutions to some rare programming problems.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='While.html'>while</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,86 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Fpconstants </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>floating point constants</h2>
|
|
||||||
<p>Similar to integer constants, floating point constants are used to make code more readable. Floating point constants are swapped at compile time for the value to which the expression evaluates.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Examples:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><code>n = .005; </code>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Floating point constants can also be expressed in a variety of scientific notation. 'E' and 'e' are both accepted as valid exponent indicators.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>
|
|
||||||
|
|
||||||
floating-point evaluates to: also evaluates to:
|
|
||||||
constant
|
|
||||||
|
|
||||||
10.0 10
|
|
||||||
2.34E5 2.34 * 10^5 234000
|
|
||||||
67e-12 67.0 * 10^-12 .000000000067
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,93 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Goto </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>goto</h2>
|
|
||||||
<p>Transfers program flow to a labeled point in the program
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>label:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>goto label; // sends program flow to the label
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Tip</h4>
|
|
||||||
<p>The use of <em>goto</em> is discouraged in C programming, and some authors of C programming books claim that the <em>goto</em> statement is never necessary, but used judiciously, it can simplify certain programs. The reason that many programmers frown upon the use of <em>goto</em> is that with the unrestrained use of <em>goto</em> statements, it is easy to create a program with undefined program flow, which can never be debugged.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>With that said, there are instances where a goto statement can come in handy, and simplify coding. One of these situations is to break out of deeply nested <em>for</em> loops, or <em>if</em> logic blocks, on a certain condition.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
for(byte r = 0; r < 255; r++){
|
|
||||||
for(byte g = 255; g > -1; g--){
|
|
||||||
for(byte b = 0; b < 255; b++){
|
|
||||||
if (analogRead(0) > 250){ goto bailout;}
|
|
||||||
// more statements ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bailout:
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,80 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ArduinoBT </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<h2><span class='wikiword'>ArduinoBT</span></h2>
|
|
||||||
<p>The Arduino BT is an Arduino board with built-in bluetooth module, allowing for wireless communication. To get started with the Arduino BT, follow the directions for the Arduino NG on your operating system (<a class='wikilink' href='Guide_Windows.html'>Windows</a>, <a class='wikilink' href='Guide_MacOSX.html'>Mac OS X</a>, <a class='urllink' href='http://www.arduino.cc/playground/Learning/Linux' rel='nofollow'>Linux</a>), with the following modifications:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ul><li>First, pair the Arduino BT with your computer and create a virtual serial port for it. Look for a bluetooth device called <strong>ARDUINOBT</strong> and the pass code is <strong>12345</strong>.
|
|
||||||
<p class='vspace'></p></li><li>Select <strong>Arduino BT</strong> from the <strong>Tools | Board</strong> menu of the Arduino environment.
|
|
||||||
</li></ul><p class='vspace'></p><h3>Information about the Arduino BT</h3>
|
|
||||||
<p>In most respects, the Arduino BT is similar to the Arduino Diecimila. Here are the main differences of BT board (besides the fact that it communicates over bluetooth instead of USB):
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ul><li>The Arduino BT is more fragile and easy to break than a regular Arduino board.
|
|
||||||
<p class='vspace'></p></li><li><strong>Don't power the board with more than 5.5 volts to the or reverse the polarity (power and ground pins) of your power supply, or you might kill the <span class='wikiword'>ATmega168</span> on the Arduino BT.</strong> The Arduino BT can, however, run with a minimum of 1.2 volts, making it easier to power with batteries.
|
|
||||||
<p class='vspace'></p></li><li>The microcontroller (an <span class='wikiword'>ATmega168</span>) on the Arduino BT is a physically smaller version of the chip on the USB Arduino boards. You can't remove it, so if you kill it, you need a new Arduino BT.
|
|
||||||
<p class='vspace'></p></li><li>There are two extra analog inputs on the Arduino BT (8 total). Two of these, however, are not connected to the pin headers on the board; you'll need to solder something to the pads next to the numbers "6" and "7".
|
|
||||||
<p class='vspace'></p></li><li>Pin 7 is connected to the reset pin of the bluetooth module; <strong>don't use it for anything</strong> (except resetting the module).
|
|
||||||
</li></ul><p class='vspace'></p><p>For more details, see the <a class='wikilink' href='http://arduino.cc/en/Main/ArduinoBoardBluetooth'>Arduino BT hardware page</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>Using the Arduino BT</h3>
|
|
||||||
<p>The on-board serial communication between the bluetooth module and the Arduino sketch (running on the <span class='wikiword'>ATmega168</span>) needs to be at 115200 baud (i.e. call Serial.begin(115200) in your setup() function). Communication between the bluetooth module and the computer can be at any baud rate.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Communication between the BT module and the computer can be temperamental. You might want to open the serial monitor a couple of seconds after resetting the board.
|
|
||||||
The text of the Arduino getting started guide is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the guide are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='Guide_ArduinoBT?action=edit.html'>Edit Page</a> | <a href='Guide_ArduinoBT?action=diff.html'>Page History</a> | <a href='Guide_ArduinoBT?action=print.html' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,73 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ArduinoEthernetShield </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<h2>Arduino Ethernet Shield</h2>
|
|
||||||
<p>The Arduino Ethernet shield allows an Arduino board to connect to the internet using the <a class='wikilink' href='Ethernet.html'>Ethernet library</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Connecting the Shield</h4>
|
|
||||||
<div><img src='http://arduino.cc/en/uploads/Guide/ArduinoWithEthernetShield.jpg' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>To use the shield, mount it on top of an Arduino board (e.g. the Diecimila). To upload sketches to the board, connect it to your computer with a USB cable as you normally would. Once the sketch has been uploaded, you can disconnect the board from your computer and power it with an external power supply.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Connect the shield to your computer or a network hub or router using a standard ethernet cable (<span class='wikiword'>CAT5</span> or <span class='wikiword'>CAT6</span> with <span class='wikiword'>RJ45</span> connectors). Connecting to a computer may require the use of a cross-over cable (although many computers, including <a class='urllink' href='http://support.apple.com/kb/HT2274' rel='nofollow'>all recent Macs</a> can do the cross-over internally).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Network Settings</h4>
|
|
||||||
<p>The shield must be assigned a MAC address and a fixed IP address using the <a class='wikilink' href='EthernetBegin.html'>Ethernet.begin()</a> function. A MAC address is a globally unique identifier for a particular device; inventing a random one should work, but don't use the same one for multiple boards. Valid IP addresses depend on the configuration of your network. (It is possible to use DHCP to dynamically assign an IP to the shield, but this is not yet implemented.) Optionally, you can also specify a network gateway and subnet.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino getting started guide is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the guide are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='Guide_ArduinoEthernetShield?action=edit.html'>Edit Page</a> | <a href='Guide_ArduinoEthernetShield?action=diff.html'>Page History</a> | <a href='Guide_ArduinoEthernetShield?action=print.html' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,81 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ArduinoLilyPad </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<h2>Guide to the <span class='wikiword'>LilyPad</span> Arduino</h2>
|
|
||||||
<p>To get started with the <span class='wikiword'>LilyPad</span> Arduino, follow the directions for the Arduino NG on your operating system (<a class='wikilink' href='Guide_Windows.html'>Windows</a>, <a class='wikilink' href='Guide_MacOSX.html'>Mac OS X</a>, <a class='urllink' href='http://www.arduino.cc/playground/Learning/Linux' rel='nofollow'>Linux</a>. Connecting the <span class='wikiword'>LilyPad</span> Arduino is a bit more complicated than a regular Arduino board (<a href='#connecting'>see below</a> for instructions and photos).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The <span class='wikiword'>LilyPad</span> Arduino is more <strong>fragile and easy to break</strong> than a regular Arduino board. Don't connect more than 5.5 volts to the + tab or reverse the power and ground pins of your power supply, or you will very likely kill the <span class='wikiword'>ATmega</span> on the <span class='wikiword'>LilyPad</span> Arduino. You can't remove the <span class='wikiword'>ATmega</span>, so if you kill it, you need a new <span class='wikiword'>LilyPad</span>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Note: More information about getting started with the <span class='wikiword'>LilyPad</span> Arduino can be found <a class='urllink' href='http://www.media.mit.edu/~leah/LilyPad' rel='nofollow'>here.</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a name='connecting' id='connecting'></a>
|
|
||||||
</p><h3>Connecting the <span class='wikiword'>LilyPad</span> Arduino</h3>
|
|
||||||
<p>To program the <span class='wikiword'>LilyPad</span> Arduino, you need to connect it to your computer. The <a class='urllink' href='http://www.sparkfun.com/commerce/product_info.php?products_id=8772' rel='nofollow'>SparkFun FTDI Basic Breakout</a> plugs into the 6-pin male header on the newest version of the <span class='wikiword'>LilyPad</span>. Use a USB <span class='wikiword'>MiniB</span> cable to connect the FTDI basic breakout to your computer. You can also use an <a class='urllink' href='http://www.ftdichip.com/Products/EvaluationKits/TTL-232R.htm' rel='nofollow'>FTDI USB-TTL Serial cable</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/lilypad_basicbreakout.jpg' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>To connect earlier versions of the board or for information on other connection options see the <a class='urllink' href='http://www.media.mit.edu/~leah/LilyPad' rel='nofollow'>LilyPad Arduino tutorial</a> on Leah's website
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>Sewing the <span class='wikiword'>LilyPad</span> Arduino</h3>
|
|
||||||
<p>The hole on each tab of the <span class='wikiword'>LilyPad</span> is large enough for a sewing needle to pass through. You can make both electrical and physical connections with stitching in conductive thread. Sew through the holes several times to insure good contact. Here's a picture showing a sewn <span class='wikiword'>LilyPad</span>:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/lilypad_sewn.jpg' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>See the <a class='urllink' href='http://www.media.mit.edu/~leah/LilyPad' rel='nofollow'>LilyPad Arduino tutorial</a> on Leah's website for more information about building a working wearable. See <a class='urllink' href='http://www.sparkfun.com/commerce/categories.php?c=135' rel='nofollow'>SparkFun</a> for more stitchable modules that you can use with your <span class='wikiword'>LilyPad</span> Arduino.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino getting started guide is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the guide are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='Guide_ArduinoLilyPad?action=edit.html'>Edit Page</a> | <a href='Guide_ArduinoLilyPad?action=diff.html'>Page History</a> | <a href='Guide_ArduinoLilyPad?action=print.html' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,73 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - ArduinoNano </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<h2>Guide to the Arduino Nano</h2>
|
|
||||||
<div><img src='http://arduino.cc/en/uploads/Guide/ArduinoNanoUSBCable.jpg' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p><em>Connecting the Arduino Nano 2.2 to a computer with a Mini-B USB cable. Note the blue power LED underneath the board.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><br clear='all' />
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>To connect the Arduino Nano to your computer, you'll need a Mini-B USB cable. This also provides power to the board, as indicated by the blue LED (which is on the bottom of the Arduino Nano 2.x and the top of the Arduino Nano 3.0).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>If you have an Arduino Nano 3.0, you'll need to select <strong>Arduino Duemilanove or Nano w/ <span class='wikiword'>ATmega32</span></strong> from the <strong>Tools > Board</strong> menu. If you have an Arduino Nano 2.x, select <strong>Arduino Diecimila, Duemilanove, or Nano w/ <span class='wikiword'>ATmega168</span></strong>. Select the correct serial port selected from the <strong>Tools > Serial Port</strong> menu. Then simply press the upload button in the Arduino environment. The board will automatically reset and the sketch will be uploaded. If you have any problems, see the <a class='wikilink' href='Guide_Troubleshooting#upload.html'>troubleshooting guide</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>For more details on the Arduino Nano, see the <a class='wikilink' href='http://arduino.cc/en/Main/ArduinoBoardNano'>hardware page</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino getting started guide is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the guide are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='Guide_ArduinoNano?action=edit.html'>Edit Page</a> | <a href='Guide_ArduinoNano?action=diff.html'>Page History</a> | <a href='Guide_ArduinoNano?action=print.html' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,125 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - MacOSX </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<h2>How To Get Arduino Running on Mac OS X (10.3.9 or later)</h2>
|
|
||||||
<p><em>This document explains how to connect your Arduino board to the computer and upload your first sketch.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>These are the steps that we'll go through:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ol><li>Get an Arduino board and cable
|
|
||||||
</li><li>Download the Arduino environment
|
|
||||||
</li><li>Install the USB drivers
|
|
||||||
</li><li>Connect the board
|
|
||||||
</li><li>Run the Arduino environment
|
|
||||||
</li><li>Upload a program
|
|
||||||
</li><li>Look for the blinking LED
|
|
||||||
</li><li>Learn to use Arduino
|
|
||||||
</li></ol><p class='vspace'></p><h3>1 | Get an Arduino board and cable</h3>
|
|
||||||
<p>In this tutorial, we assume you're using an Arduino Duemilanove or Diecimila. If you have another board, read the corresponding page in this getting started guide.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The Arduino is a simple board that contains everything you need to start working with electronics and microcontroller programming. This diagram illustrates the major components of an Arduino Diecimila. (The Arduino Duemilanove is almost identical.)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/ArduinoDiecimilaComponents.jpg' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>You also need a standard USB cable (A plug to B plug): the kind you would connect to a USB printer, for example.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>2 | Download the Arduino environment</h3>
|
|
||||||
<p>To program the Arduino board you need the Arduino environment.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><strong>Download</strong>: the latest version from the <a class='wikilink' href='http://arduino.cc/en/Main/Software'>download page</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>When the download finishes, unzip the downloaded file. Make sure to preserve the folder structure. Double-click the folder to open it. There should be a few files and sub-folders inside.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>3 | Install the USB drivers</h3>
|
|
||||||
<p>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 <strong>drivers</strong> directory of the Arduino distribution.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>You'll need to select the correct drivers for your computer. Use:
|
|
||||||
</p><ul><li><strong><span class='wikiword'>FTDIUSBSerialDriver</span>_v2_1_9.dmg</strong> for older (PPC) Macs like the Powerbook, iBook, G4 or G5
|
|
||||||
</li><li><strong><span class='wikiword'>FTDIUSBSerialDriver</span>_v2_2_9_Intel.dmg</strong> for newer (Intel) Macs like the <span class='wikiword'>MacBook</span>, <span class='wikiword'>MacBook</span> Pro, or Mac Pro
|
|
||||||
</li></ul><p class='vspace'></p><p>(The latest version of the drivers can be found on the <a class='urllink' href='http://www.ftdichip.com/Drivers/VCP.htm' rel='nofollow'>FTDI website</a>.)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>4 | Connect the board</h3>
|
|
||||||
<p>On the Diecimila, the power source is selected by the jumper between the USB and power plugs. To power the board from the USB port (good for controlling low power devices like <span class='wikiword'>LEDs</span>), place the jumper on the two pins closest to the USB plug. To power the board from an external power supply (6-12V), place the jumper on the two pins closest to the power plug. On the Duemilanove, the power source is selected automatically (there is no power selection jumper). In any case, connect the board to a USB port on your computer.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The green power LED (labelled <strong>PWR</strong>) should go on.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>5 | Run the Arduino environment</h3>
|
|
||||||
<p>(Mac OSX): Copy the Arduino application to your Applications directory. Double-click the Arduino application.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>(Windows): Open the Arduino folder and double-click the Arduino application.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>6 | Upload a program</h3>
|
|
||||||
<p>Open the LED blink example sketch: <strong>File > Sketchbook > Examples > Digital > Blink</strong>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Select the serial device of the Arduino board from the <strong>Tools > Serial Port</strong> menu. On the Mac, this should be something with <strong>/dev/tty.usbserial</strong> in it.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>You'll need to select the entry in the <strong>Tools > Board</strong> menu that corresponds to your Arduino. For newer Arduino boards with an <span class='wikiword'>ATmega328</span> (check the text on the chip on the board), select <strong>Arduino Duemilanove w/ <span class='wikiword'>ATmega328</span></strong>. Previously, Arduino boards came with an <span class='wikiword'>ATmega168</span>; for those, select <strong>Arduino Diecimila or Duemilanove w/ <span class='wikiword'>ATmega168</span></strong>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Now, simply click the "Upload" button in the environment. Wait a few seconds - you should see the RX and TX leds on the board flashing. If the upload is successful, the message "Done uploading." will appear in the status bar. (<em>Note:</em> If you have an Arduino Mini, NG, or other board, you'll need to physically present the reset button on the board immediately before pressing the upload button.)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/UploadButton.png' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><h3>7 | Look for the blinking LED</h3>
|
|
||||||
<p>A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board start to blink (in orange). If it does, congratulations! You've gotten Arduino up-and-running.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>If you have problems, please see the <a class='wikilink' href='Guide_Troubleshooting.html'>troubleshooting suggestions</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>8 | Learn to use Arduino</h3>
|
|
||||||
<ul><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Examples</a>: try these example programs.
|
|
||||||
</li><li><a class='wikilink' href='index.html'>Reference</a>: read the reference for the Arduino language.
|
|
||||||
</li></ul><p>The text of the Arduino getting started guide is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the guide are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='Guide_MacOSX?action=edit.html'>Edit Page</a> | <a href='Guide_MacOSX?action=diff.html'>Page History</a> | <a href='Guide_MacOSX?action=print.html' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,137 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Windows </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<h2>How To Get Arduino Running on Windows</h2>
|
|
||||||
<p><em>This document explains how to connect your Arduino board to the computer and upload your first sketch.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>These are the steps that we'll go through:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ol><li>Get an Arduino board and cable
|
|
||||||
</li><li>Download the Arduino environment
|
|
||||||
</li><li>Install the USB drivers
|
|
||||||
</li><li>Connect the board
|
|
||||||
</li><li>Run the Arduino environment
|
|
||||||
</li><li>Upload a program
|
|
||||||
</li><li>Look for the blinking LED
|
|
||||||
</li><li>Learn to use Arduino
|
|
||||||
</li></ol><p class='vspace'></p><h3>1 | Get an Arduino board and cable</h3>
|
|
||||||
<p>In this tutorial, we assume you're using an Arduino Duemilanove or Diecimila. If you have another board, read the corresponding page in this getting started guide.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The Arduino is a simple board that contains everything you need to start working with electronics and microcontroller programming. This diagram illustrates the major components of an Arduino Diecimila. (The Arduino Duemilanove is almost identical.)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/ArduinoDiecimilaComponents.jpg' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>You also need a standard USB cable (A plug to B plug): the kind you would connect to a USB printer, for example.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>2 | Download the Arduino environment</h3>
|
|
||||||
<p>To program the Arduino board you need the Arduino environment.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><strong>Download</strong>: the latest version from the <a class='wikilink' href='http://arduino.cc/en/Main/Software'>download page</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>When the download finishes, unzip the downloaded file. Make sure to preserve the folder structure. Double-click the folder to open it. There should be a few files and sub-folders inside.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>3 | Locate the USB drivers</h3>
|
|
||||||
<p>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 <code>drivers/FTDI USB Drivers</code> directory of the Arduino distribution. In the next step ("Connect the board"), you will point Window's Add New Hardware wizard to these drivers.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The latest version of the drivers can be found on the <a class='urllink' href='http://www.ftdichip.com/Drivers/VCP.htm' rel='nofollow'>FTDI website</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>4 | Connect the board</h3>
|
|
||||||
<p>On the Diecimila, the power source is selected by the jumper between the USB and power plugs. To power the board from the USB port (good for controlling low power devices like <span class='wikiword'>LEDs</span>), place the jumper on the two pins closest to the USB plug. To power the board from an external power supply (6-12V), place the jumper on the two pins closest to the power plug. On the Duemilanove, the power source is selected automatically (there is no power selection jumper). In any case, connect the board to a USB port on your computer.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The green power LED (labelled <strong>PWR</strong>) should go on.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The Add New Hardware wizard will open. Tell it not to connect to Windows update and click next.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/wizard1-step1.png' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>Then select "Install from a list or specified location (Advanced)" and click next.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/wizard1-step2.png' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>Make sure that "Search for the best driver in these locations is checked"; uncheck "Search removable media"; check "Include this location in the search" and browse to the location you unzipped the USB drivers to in the previous step. Click next.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/wizard1-step3.png' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>The wizard will search for the driver and then tell you that a "USB Serial Converter" was found. Click finish.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/wizard1-step4.png' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>The new hardware wizard will appear again. Go through the same steps. This time, a "USB Serial Port" will be found.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>5 | Run the Arduino environment</h3>
|
|
||||||
<p>(Mac OSX): Copy the Arduino application to your Applications directory. Double-click the Arduino application.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>(Windows): Open the Arduino folder and double-click the Arduino application.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>6 | Upload a program</h3>
|
|
||||||
<p>Open the LED blink example sketch: <strong>File > Sketchbook > Examples > Digital > Blink</strong>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Select the serial device of the Arduino board from the Tools | Serial Port menu. On Windows, this should be <code><span class='wikiword'>COM1</span></code> or <code><span class='wikiword'>COM2</span></code> for a serial Arduino board, or <code><span class='wikiword'>COM3</span></code>, <code><span class='wikiword'>COM4</span></code>, or <code><span class='wikiword'>COM5</span></code> for a USB board. To find out, open the Windows Device Mananger (in the Hardware tab of System control panel). Look for a "USB Serial Port" in the Ports section; that's the Arduino board.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/device-manager.png' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><p>You'll need to select the entry in the <strong>Tools > Board</strong> menu that corresponds to your Arduino. For newer Arduino boards with an <span class='wikiword'>ATmega328</span> (check the text on the chip on the board), select <strong>Arduino Duemilanove w/ <span class='wikiword'>ATmega328</span></strong>. Previously, Arduino boards came with an <span class='wikiword'>ATmega168</span>; for those, select <strong>Arduino Diecimila or Duemilanove w/ <span class='wikiword'>ATmega168</span></strong>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Now, simply click the "Upload" button in the environment. Wait a few seconds - you should see the RX and TX leds on the board flashing. If the upload is successful, the message "Done uploading." will appear in the status bar. (<em>Note:</em> If you have an Arduino Mini, NG, or other board, you'll need to physically present the reset button on the board immediately before pressing the upload button.)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><div><img src='http://arduino.cc/en/uploads/Guide/UploadButton.png' alt='' title='' /></div>
|
|
||||||
<p class='vspace'></p><h3>7 | Look for the blinking LED</h3>
|
|
||||||
<p>A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board start to blink (in orange). If it does, congratulations! You've gotten Arduino up-and-running.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>If you have problems, please see the <a class='wikilink' href='Guide_Troubleshooting.html'>troubleshooting suggestions</a>.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>8 | Learn to use Arduino</h3>
|
|
||||||
<ul><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Examples</a>: try these example programs.
|
|
||||||
</li><li><a class='wikilink' href='index.html'>Reference</a>: read the reference for the Arduino language.
|
|
||||||
</li></ul><p>The text of the Arduino getting started guide is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the guide are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='Guide_Windows?action=edit.html'>Edit Page</a> | <a href='Guide_Windows?action=diff.html'>Page History</a> | <a href='Guide_Windows?action=print.html' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,86 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Getting Started </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='selflink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<h2>Getting Started with Arduino</h2>
|
|
||||||
<p class='vspace'></p><table width='100%' border='0' cellpadding='5' cellspacing='0'><tr><td width='50%' valign='top'>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Guide_Introduction.html'>Introduction</a>: What Arduino is and why you'd want to use it.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Installation: Step-by-step instructions for setting up the Arduino software and connecting it to an Arduino Duemilanove.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ul><li><a class='wikilink' href='Guide_Windows.html'>Windows</a>
|
|
||||||
</li><li><a class='wikilink' href='Guide_MacOSX.html'>Mac OS X</a>
|
|
||||||
</li><li><a class='urllink' href='http://www.arduino.cc/playground/Learning/Linux' rel='nofollow'>Linux</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='Guide_Environment.html'>Environment</a>: Description of the Arduino development environment.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='Guide_Troubleshooting.html'>Troubleshooting</a>: Advice on what to do if things don't work.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p></td><td width='50%' valign='top'>
|
|
||||||
<p class='vspace'></p><p>Instructions for other boards:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><ul><li><a class='wikilink' href='Guide_ArduinoNano.html'>Arduino Nano</a>
|
|
||||||
</li><li><a class='wikilink' href='Guide_ArduinoMini.html'>Arduino Mini</a>
|
|
||||||
</li><li><a class='wikilink' href='Guide_ArduinoBT.html'>Arduino BT</a>
|
|
||||||
</li><li><a class='wikilink' href='Guide_ArduinoLilyPad.html'>LilyPad Arduino</a>
|
|
||||||
</li><li><a class='wikilink' href='Guide_ArduinoPro.html'>Arduino Pro</a>
|
|
||||||
</li><li><a class='wikilink' href='Guide_ArduinoProMini.html'>Arduino Pro Mini</a>
|
|
||||||
<p class='vspace'></p></li><li><a class='wikilink' href='Guide_ArduinoXbeeShield.html'>Xbee shield</a>
|
|
||||||
</li><li><a class='wikilink' href='Guide_ArduinoEthernetShield.html'>Ethernet shield</a>
|
|
||||||
</li></ul><p class='vspace'></p></td></tr></table>
|
|
||||||
<p>The text of the Arduino getting started guide is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the guide are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='Guide_HomePage?action=edit.html'>Edit Page</a> | <a href='Guide_HomePage?action=diff.html'>Page History</a> | <a href='Guide_HomePage?action=print.html' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,83 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - HighByte </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>highByte()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Extracts the high-order (leftmost) byte of a word (or the second lowest byte of a larger data type).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>highByte(x)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: a value of any type
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>byte
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='LowByte.html'>lowByte</a>()
|
|
||||||
</li><li><a class='wikilink' href='WordCast.html'>word</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,110 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - If </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>if (conditional) and ==, !=, <, > (comparison operators)</h2>
|
|
||||||
<p><strong><code>if</code></strong>, which is used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number. The format for an if test is:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>if (someVariable > 50)
|
|
||||||
{
|
|
||||||
// do something here
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p>The program tests to see if someVariable is greater than 50. If it is, the program takes a particular action. Put another way, if the statement in parentheses is true, the statements inside the brackets are run. If not, the program skips over the code.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The brackets may be omitted after an <em>if</em> statement. If this is done, the next line (defined by the semicolon) becomes the only conditional statement.
|
|
||||||
</p><pre>
|
|
||||||
|
|
||||||
if (x > 120) digitalWrite(LEDpin, HIGH);
|
|
||||||
|
|
||||||
if (x > 120)
|
|
||||||
digitalWrite(LEDpin, HIGH);
|
|
||||||
|
|
||||||
if (x > 120){ digitalWrite(LEDpin, HIGH); }
|
|
||||||
|
|
||||||
if (x > 120){
|
|
||||||
digitalWrite(LEDpin1, HIGH);
|
|
||||||
digitalWrite(LEDpin2, HIGH);
|
|
||||||
} // all are correct
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p>The statements being evaluated inside the parentheses require the use of one or more operators:
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h3>Comparison Operators:</h3>
|
|
||||||
<pre> <strong>x == y</strong> (x is equal to y)
|
|
||||||
<strong>x != y</strong> (x is not equal to y)
|
|
||||||
<strong>x < y</strong> (x is less than y)
|
|
||||||
<strong>x > y</strong> (x is greater than y)
|
|
||||||
<strong>x <= y</strong> (x is less than or equal to y)
|
|
||||||
<strong>x >= y</strong> (x is greater than or equal to y)
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Warning: </h4>
|
|
||||||
<p>Beware of accidentally using the single equal sign (e.g.<code> if (x = 10)</code> ). The single equal sign is the assignment operator, and sets x to 10 (puts the value 10 into the variable x). Instead use the double equal sign (e.g.<code> if (x == 10) </code>), which is the comparison operator, and tests <em>whether</em> x is equal to 10 or not. The latter statement is only true if x equals 10, but the former statement will always be true.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>This is because C evaluates the statement <code> if (x=10) </code> as follows: 10 is assigned to x (remember that the single equal sign is the <a class='wikilink' href='Assignment.html'>assignment operator</a>), so x now contains 10. Then the 'if' conditional evaluates 10, which always evaluates to TRUE, since any non-zero number evaluates to TRUE. Consequently, <code>if (x = 10)</code> will always evaluate to TRUE, which is not the desired result when using an 'if' statement. Additionally, the variable x will be set to 10, which is also not a desired action.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><strong>if</strong> can also be part of a branching control structure using the <a class='wikilink' href='Else.html'>if...else</a>] construction.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,84 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Include </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>#include</h2>
|
|
||||||
<p><strong>#include</strong> is used to include outside libraries in your sketch. This gives the programmer access to a large group of standard C libraries (groups of pre-made functions), and also libraries written especially for Arduino.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The main reference page for AVR C libraries (AVR is a reference to the Atmel chips on which the Arduino is based) is <a class='urllink' href='http://www.nongnu.org/avr-libc/user-manual/modules.html' rel='nofollow'>here.</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Note that <strong>#include</strong>, similar to <strong>#define</strong>, has no semicolon terminator, and the compiler will yield cryptic error messages if you add one.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<p>This example includes a library that is used to put data into the program space <em>flash</em> instead of <em>ram</em>. This saves the ram space for dynamic memory needs and makes large lookup tables more practical.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
prog_uint16_t myConstants[] PROGMEM = {0, 21140, 702 , 9128, 0, 25764, 8456,
|
|
||||||
0,0,0,0,0,0,0,0,29810,8968,29762,29762,4500};
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,93 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Increment </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>++ (increment) / -- (decrement)</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Increment or decrement a variable
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<pre>
|
|
||||||
x++; // increment x by one and returns the old value of x
|
|
||||||
++x; // increment x by one and returns the new value of x
|
|
||||||
|
|
||||||
x-- ; // decrement x by one and returns the old value of x
|
|
||||||
--x ; // decrement x by one and returns the new value of x
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: an integer or long (possibly unsigned)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>The original or newly incremented / decremented value of the variable.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Examples</h4>
|
|
||||||
<pre>x = 2;
|
|
||||||
y = ++x; // x now contains 3, y contains 3
|
|
||||||
y = x--; // x contains 2 again, y still contains 3
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<p><a class='wikilink' href='Arithmetic.html'>+=</a><br /><a class='wikilink' href='Arithmetic.html'>-=</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,92 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - IncrementCompound </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>+= , -= , *= , /= </h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Perform a mathematical operation on a variable with another constant or variable. The += (et al) operators are just a convenient shorthand for the expanded syntax, listed below.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<pre>
|
|
||||||
x += y; // equivalent to the expression x = x + y;
|
|
||||||
x -= y; // equivalent to the expression x = x - y;
|
|
||||||
x *= y; // equivalent to the expression x = x * y;
|
|
||||||
x /= y; // equivalent to the expression x = x / y;
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: any variable type
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>y: any variable type or constant
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Examples</h4>
|
|
||||||
<pre>x = 2;
|
|
||||||
x += 4; // x now contains 6
|
|
||||||
x -= 3; // x now contains 3
|
|
||||||
x *= 10; // x now contains 30
|
|
||||||
x /= 2; // x now contains 15
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,101 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Int </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>int</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Integers are your primary datatype for number storage, and store a 2 byte value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>Int's store negative numbers with a technique called <a class='urllink' href='http://en.wikipedia.org/wiki/2%27s_complement' rel='nofollow'>2's complement math.</a> The highest bit, sometimes refered to as the "sign" bit, flags the number as a negative number. The rest of the bits are inverted and 1 is added.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The Arduino takes care of dealing with negative numbers for you, so that arithmetic operations work transparently in the expected manner. There can be an unexpected complication in dealing with the <a class='wikilink' href='Bitshift.html'>bitshift right operator (>>)</a> however.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre> int ledPin = 13;
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<pre> int var = val;
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><ul><li>var - your int variable name
|
|
||||||
</li><li>val - the value you assign to that variable
|
|
||||||
</li></ul><p class='vspace'></p><h4>Coding Tip</h4>
|
|
||||||
<p>When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacitiy, note that this happens in both directions.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><pre> int x
|
|
||||||
x = -32,768;
|
|
||||||
x = x - 1; // x now contains 32,767 - rolls over in neg. direction
|
|
||||||
|
|
||||||
x = 32,767;
|
|
||||||
x = x + 1; // x now contains -32,768 - rolls over
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See Also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Byte.html'>byte</a>
|
|
||||||
</li><li><a class='wikilink' href='UnsignedInt.html'>unsigned int</a>
|
|
||||||
</li><li><a class='wikilink' href='Long.html'>long</a>
|
|
||||||
</li><li><a class='wikilink' href='UnsignedLong.html'>unsigned long</a>
|
|
||||||
</li><li><a class='wikilink' href='IntegerConstants.html'>Integer Constants</a>
|
|
||||||
</li><li><a class='urllink' href='VariableDeclaration.html' rel='nofollow'>Variable Declaration</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,82 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - IntCast </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>int()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Converts a value to the <a class='wikilink' href='Int.html'>int</a> data type.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Syntax</h4>
|
|
||||||
<p>int(x)
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>x: a value of any type
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>int
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>See also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='Int.html'>int</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,94 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - Interrupts </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2>interrupts()</h2>
|
|
||||||
<h4>Description</h4>
|
|
||||||
<p>Re-enables interrupts (after they've been disabled by <a class='wikilink' href='NoInterrupts.html'>noInterrupts</a>()). Interrupts allow certain important tasks to happen in the background and are enabled by default. Some functions will not work while interrupts are disabled, and incoming communication may be ignored. Interrupts can slightly disrupt the timing of code, however, and may be disabled for particularly critical sections of code.
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Parameters</h4>
|
|
||||||
<p>None
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Returns</h4>
|
|
||||||
<p>None
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Example</h4>
|
|
||||||
<pre>
|
|
||||||
void setup() {}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
noInterrupts();
|
|
||||||
// critical, time-sensitive code here
|
|
||||||
interrupts();
|
|
||||||
// other code here
|
|
||||||
}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<p class='vspace'></p><h4>See Also</h4>
|
|
||||||
<ul><li><a class='wikilink' href='NoInterrupts.html'>noInterrupts</a>()
|
|
||||||
</li><li><a class='wikilink' href='AttachInterrupt.html'>attachInterrupt</a>()
|
|
||||||
</li><li><a class='wikilink' href='DetachInterrupt.html'>detachInterrupt</a>()
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,101 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Arduino - LiquidCrystal </title>
|
|
||||||
<link rel='stylesheet' href='arduino.css' type='text/css' />
|
|
||||||
<meta name="verify-v1" content="TtxFIEJAB6zdJ509wLxjnapQzKAMNm9u0Wj4ho6wxIY=" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="page">
|
|
||||||
<!--PageHeaderFmt-->
|
|
||||||
<div id="pageheader">
|
|
||||||
<div class="title"><a href="http://www.arduino.cc"/>Arduino</a></div>
|
|
||||||
<div class="search">
|
|
||||||
<!-- SiteSearch Google -->
<FORM method=GET action="http://www.google.com/search">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="search">
<input type=hidden name=domains value="http://www.arduino.cc/">
|
|
||||||
<input type=hidden name=sitesearch value="http://www.arduino.cc/">
|
|
||||||
</FORM>
<!-- SiteSearch Google -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--/PageHeaderFmt-->
|
|
||||||
<!--PageLeftFmt-->
|
|
||||||
<div id="pagenav" style="text-align: right">
|
|
||||||
<div style="float: left;">
|
|
||||||
<p><a class='wikilink' href='http://arduino.cc/en/Main/Buy'>Buy</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Software'>Download</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='Guide_index.html'>Getting Started</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Tutorial/HomePage'>Learning</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='index.html'>Reference</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='http://arduino.cc/en/Main/Hardware'>Hardware</a>
|
|
||||||
|
|
|
||||||
<a class='wikilink' href='FAQ.html'>FAQ</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/blog/" rel="nofollow">Blog »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl" rel="nofollow">Forum »</a> |
|
|
||||||
<a class="urllink" href="http://www.arduino.cc/playground/" rel="nofollow">Playground »</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageLeftFmt-->
|
|
||||||
<div id="pagetext">
|
|
||||||
<!--PageText-->
|
|
||||||
<div id='wikitext'>
|
|
||||||
<p><strong>Reference</strong> <a class='wikilink' href='index.html'>Language</a> (<a class='wikilink' href='Extended.html'>extended</a>) | <a class='wikilink' href='Libraries.html'>Libraries</a> | <a class='wikilink' href='Comparison.html'>Comparison</a> | <a class='wikilink' href='Changes.html'>Changes</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h2><span class='wikiword'>LiquidCrystal</span> Library</h2>
|
|
||||||
<p>This library allows an Arduino board to control <span class='wikiword'>LiquidCrystal</span> displays (<span class='wikiword'>LCDs</span>) based on the Hitachi <span class='wikiword'>HD44780</span> (or a compatible) chipset, which is found on most text-based <span class='wikiword'>LCDs</span>. The library works with in either 4- or 8-bit mode (i.e. using 4 or 8 data lines in addition to the rs, enable, and, optionally, the rw control lines).
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><h4>Function</h4>
|
|
||||||
<ul><li><a class='wikilink' href='LiquidCrystalConstructor.html'>LiquidCrystal()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalBegin.html'>begin()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalClear.html'>clear()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalHome.html'>home()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalSetCursor.html'>setCursor()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalWrite.html'>write()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalPrint.html'>print()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalCursor.html'>cursor()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalNoCursor.html'>noCursor()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalBlink.html'>blink()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalNoBlink.html'>noBlink()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalDisplay.html'>display()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalNoDisplay.html'>noDisplay()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalScrollDisplayLeft.html'>scrollDisplayLeft()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalScrollDisplayRight.html'>scrollDisplayRight()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalAutoscroll.html'>autoscroll()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalNoAutoscroll.html'>noAutoscroll()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalLeftToRight.html'>leftToRight()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalRightToLeft.html'>rightToLeft()</a>
|
|
||||||
</li><li><a class='wikilink' href='LiquidCrystalCreateChar.html'>createChar()</a>
|
|
||||||
</li></ul><p class='vspace'></p><p>Examples
|
|
||||||
</p><ul><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystal'>Hello World</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystalBlink'>Blink</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystalCursor'>Cursor</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystalDisplay'>Display</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystalTextDirection'>Text Direction</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystalAutoscroll'>Autoscroll</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystalSerial'>Serial input</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystalSetCursor'>SetCursor</a>
|
|
||||||
</li><li><a class='wikilink' href='http://arduino.cc/en/Tutorial/LiquidCrystalScroll'>Scroll</a>
|
|
||||||
</li></ul><p class='vspace'></p><p><a class='wikilink' href='index.html'>Reference Home</a>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p><em>Corrections, suggestions, and new documentation should be posted to the <a class='urllink' href='http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?board=swbugs' rel='nofollow'>Forum</a>.</em>
|
|
||||||
</p>
|
|
||||||
<p class='vspace'></p><p>The text of the Arduino reference is licensed under a
|
|
||||||
<a class='urllink' href='http://creativecommons.org/licenses/by-sa/3.0/' rel='nofollow'>Creative Commons Attribution-ShareAlike 3.0 License</a>. Code samples in the reference are released into the public domain.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--PageFooterFmt-->
|
|
||||||
<div id="pagefooter">
|
|
||||||
<a href='#'>Edit Page</a> | <a href='#'>Page History</a> | <a href='#' target='_blank'>Printable View</a> | <a href='http://arduino.cc/en/Site/AllRecentChanges'>All Recent Site Changes</a>
|
|
||||||
</div>
|
|
||||||
<!--/PageFooterFmt-->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue