mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -24,7 +24,8 @@ const int threshold = 10; // minimum reading of the sensors that generates a
|
|||||||
|
|
||||||
// notes to play, corresponding to the 3 sensors:
|
// notes to play, corresponding to the 3 sensors:
|
||||||
int notes[] = {
|
int notes[] = {
|
||||||
NOTE_A4, NOTE_B4,NOTE_C3 };
|
NOTE_A4, NOTE_B4, NOTE_C3
|
||||||
|
};
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
|
@ -19,11 +19,13 @@ This example code is in the public domain.
|
|||||||
|
|
||||||
// notes in the melody:
|
// notes in the melody:
|
||||||
int melody[] = {
|
int melody[] = {
|
||||||
NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};
|
NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4
|
||||||
|
};
|
||||||
|
|
||||||
// note durations: 4 = quarter note, 8 = eighth note, etc.:
|
// note durations: 4 = quarter note, 8 = eighth note, etc.:
|
||||||
int noteDurations[] = {
|
int noteDurations[] = {
|
||||||
4, 8, 8, 4,4,4,4,4 };
|
4, 8, 8, 4, 4, 4, 4, 4
|
||||||
|
};
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// iterate over the notes of the melody:
|
// iterate over the notes of the melody:
|
||||||
|
@ -23,7 +23,8 @@ This example code is in the public domain.
|
|||||||
|
|
||||||
int timer = 100; // The higher the number, the slower the timing.
|
int timer = 100; // The higher the number, the slower the timing.
|
||||||
int ledPins[] = {
|
int ledPins[] = {
|
||||||
2, 7, 4, 6, 5, 3 }; // an array of pin numbers to which LEDs are attached
|
2, 7, 4, 6, 5, 3
|
||||||
|
}; // an array of pin numbers to which LEDs are attached
|
||||||
int pinCount = 6; // the number of pins (i.e. the length of the array)
|
int pinCount = 6; // the number of pins (i.e. the length of the array)
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
@ -36,11 +36,13 @@
|
|||||||
|
|
||||||
// 2-dimensional array of row pin numbers:
|
// 2-dimensional array of row pin numbers:
|
||||||
const int row[8] = {
|
const int row[8] = {
|
||||||
2,7,19,5,13,18,12,16 };
|
2, 7, 19, 5, 13, 18, 12, 16
|
||||||
|
};
|
||||||
|
|
||||||
// 2-dimensional array of column pin numbers:
|
// 2-dimensional array of column pin numbers:
|
||||||
const int col[8] = {
|
const int col[8] = {
|
||||||
6,11,10,3,17,4,8,9 };
|
6, 11, 10, 3, 17, 4, 8, 9
|
||||||
|
};
|
||||||
|
|
||||||
// 2-dimensional array of pixels:
|
// 2-dimensional array of pixels:
|
||||||
int pixels[8][8];
|
int pixels[8][8];
|
||||||
|
@ -26,7 +26,8 @@ const int analogPin = A0; // the pin that the potentiometer is attached to
|
|||||||
const int ledCount = 10; // the number of LEDs in the bar graph
|
const int ledCount = 10; // the number of LEDs in the bar graph
|
||||||
|
|
||||||
int ledPins[] = {
|
int ledPins[] = {
|
||||||
2, 3, 4, 5, 6, 7,8,9,10,11 }; // an array of pin numbers to which LEDs are attached
|
2, 3, 4, 5, 6, 7, 8, 9, 10, 11
|
||||||
|
}; // an array of pin numbers to which LEDs are attached
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
@ -40,7 +40,9 @@ void setup() {
|
|||||||
|
|
||||||
// for debugging, wait until a serial console is connected
|
// for debugging, wait until a serial console is connected
|
||||||
delay(4000);
|
delay(4000);
|
||||||
while (!Serial) { ; }
|
while (!Serial) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
// start-up the bridge
|
// start-up the bridge
|
||||||
Bridge.begin();
|
Bridge.begin();
|
||||||
|
@ -40,7 +40,9 @@ void setup() {
|
|||||||
|
|
||||||
// for debugging, wait until a serial console is connected
|
// for debugging, wait until a serial console is connected
|
||||||
delay(4000);
|
delay(4000);
|
||||||
while (!Serial) { ; }
|
while (!Serial) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
// start-up the bridge
|
// start-up the bridge
|
||||||
Bridge.begin();
|
Bridge.begin();
|
||||||
|
@ -41,7 +41,9 @@ void setup() {
|
|||||||
|
|
||||||
// for debugging, wait until a serial console is connected
|
// for debugging, wait until a serial console is connected
|
||||||
delay(4000);
|
delay(4000);
|
||||||
while (!Serial) { ; }
|
while (!Serial) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
// start-up the bridge
|
// start-up the bridge
|
||||||
Bridge.begin();
|
Bridge.begin();
|
||||||
|
@ -38,7 +38,9 @@ void setup() {
|
|||||||
|
|
||||||
// for debugging, wait until a serial console is connected
|
// for debugging, wait until a serial console is connected
|
||||||
delay(4000);
|
delay(4000);
|
||||||
while (!Serial) { ; }
|
while (!Serial) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
// start-up the bridge
|
// start-up the bridge
|
||||||
Bridge.begin();
|
Bridge.begin();
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
// assign a MAC address for the ethernet controller.
|
// assign a MAC address for the ethernet controller.
|
||||||
// fill in your address here:
|
// fill in your address here:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
// assign an IP address for the controller:
|
// assign an IP address for the controller:
|
||||||
IPAddress ip(192, 168, 1, 20);
|
IPAddress ip(192, 168, 1, 20);
|
||||||
IPAddress gateway(192, 168, 1, 1);
|
IPAddress gateway(192, 168, 1, 1);
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
// The IP address will be dependent on your local network.
|
// The IP address will be dependent on your local network.
|
||||||
// gateway and subnet are optional:
|
// gateway and subnet are optional:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
IPAddress ip(192, 168, 1, 177);
|
IPAddress ip(192, 168, 1, 177);
|
||||||
IPAddress gateway(192, 168, 1, 1);
|
IPAddress gateway(192, 168, 1, 1);
|
||||||
IPAddress subnet(255, 255, 0, 0);
|
IPAddress subnet(255, 255, 0, 0);
|
||||||
|
@ -35,7 +35,8 @@ http://arduino.cc/en/Tutorial/CosmClient
|
|||||||
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
|
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
|
||||||
// fill in your address here:
|
// fill in your address here:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
|
|
||||||
// fill in an available IP address on your network here,
|
// fill in an available IP address on your network here,
|
||||||
// for manual configuration:
|
// for manual configuration:
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
// assign a MAC address for the ethernet controller.
|
// assign a MAC address for the ethernet controller.
|
||||||
// fill in your address here:
|
// fill in your address here:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
|
|
||||||
// fill in an available IP address on your network here,
|
// fill in an available IP address on your network here,
|
||||||
// for manual configuration:
|
// for manual configuration:
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
// Enter a MAC address for your controller below.
|
// Enter a MAC address for your controller below.
|
||||||
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
|
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
|
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
|
||||||
|
};
|
||||||
|
|
||||||
// Initialize the Ethernet client library
|
// Initialize the Ethernet client library
|
||||||
// with the IP address and port of the server
|
// with the IP address and port of the server
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
// The IP address will be dependent on your local network.
|
// The IP address will be dependent on your local network.
|
||||||
// gateway and subnet are optional:
|
// gateway and subnet are optional:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
|
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
|
||||||
|
};
|
||||||
IPAddress ip(192, 168, 1, 177);
|
IPAddress ip(192, 168, 1, 177);
|
||||||
IPAddress gateway(192, 168, 1, 1);
|
IPAddress gateway(192, 168, 1, 1);
|
||||||
IPAddress subnet(255, 255, 0, 0);
|
IPAddress subnet(255, 255, 0, 0);
|
||||||
|
@ -35,7 +35,8 @@ http://arduino.cc/en/Tutorial/PachubeClient
|
|||||||
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
|
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
|
||||||
// fill in your address here:
|
// fill in your address here:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
|
|
||||||
// fill in an available IP address on your network here,
|
// fill in an available IP address on your network here,
|
||||||
// for manual configuration:
|
// for manual configuration:
|
||||||
|
@ -38,7 +38,8 @@
|
|||||||
// assign a MAC address for the ethernet controller.
|
// assign a MAC address for the ethernet controller.
|
||||||
// fill in your address here:
|
// fill in your address here:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
|
|
||||||
// fill in an available IP address on your network here,
|
// fill in an available IP address on your network here,
|
||||||
// for manual configuration:
|
// for manual configuration:
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
// Enter a MAC address and IP address for your controller below.
|
// Enter a MAC address and IP address for your controller below.
|
||||||
// The IP address will be dependent on your local network:
|
// The IP address will be dependent on your local network:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
IPAddress ip(192, 168, 1, 177);
|
IPAddress ip(192, 168, 1, 177);
|
||||||
|
|
||||||
// Enter the IP address of the server you're connecting to:
|
// Enter the IP address of the server you're connecting to:
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
// Enter a MAC address and IP address for your controller below.
|
// Enter a MAC address and IP address for your controller below.
|
||||||
// The IP address will be dependent on your local network:
|
// The IP address will be dependent on your local network:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
IPAddress ip(192, 168, 1, 177);
|
IPAddress ip(192, 168, 1, 177);
|
||||||
|
|
||||||
unsigned int localPort = 8888; // local port to listen on
|
unsigned int localPort = 8888; // local port to listen on
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
// Enter a MAC address for your controller below.
|
// Enter a MAC address for your controller below.
|
||||||
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
|
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
|
|
||||||
unsigned int localPort = 8888; // local port to listen for UDP packets
|
unsigned int localPort = 8888; // local port to listen for UDP packets
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
// assign a MAC address for the ethernet controller.
|
// assign a MAC address for the ethernet controller.
|
||||||
// fill in your address here:
|
// fill in your address here:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
// fill in an available IP address on your network here,
|
// fill in an available IP address on your network here,
|
||||||
// for manual configuration:
|
// for manual configuration:
|
||||||
IPAddress ip(10, 0, 0, 20);
|
IPAddress ip(10, 0, 0, 20);
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
// Enter a MAC address and IP address for your controller below.
|
// Enter a MAC address and IP address for your controller below.
|
||||||
// The IP address will be dependent on your local network:
|
// The IP address will be dependent on your local network:
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
|
};
|
||||||
IPAddress ip(192, 168, 1, 177);
|
IPAddress ip(192, 168, 1, 177);
|
||||||
|
|
||||||
// Initialize the Ethernet server library
|
// Initialize the Ethernet server library
|
||||||
|
@ -238,7 +238,8 @@ unsigned int sendbuf[] = { /* NEC format */
|
|||||||
560, 560, 560, 1690, 560, 1690, 560, 560, /* 6 */
|
560, 560, 560, 1690, 560, 1690, 560, 560, /* 6 */
|
||||||
560, 560, 560, 1690, 560, 1690, 560, 1690, /* 7 */
|
560, 560, 560, 1690, 560, 1690, 560, 1690, /* 7 */
|
||||||
560, 1690, 560, 560, 560, 560, 560, 560, /* 8 */
|
560, 1690, 560, 560, 560, 560, 560, 560, /* 8 */
|
||||||
560};
|
560
|
||||||
|
};
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
if (mode == SENDER) {
|
if (mode == SENDER) {
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
Turn Test
|
|
||||||
|
|
||||||
Check if the robot turns a certain amount of degrees.
|
|
||||||
|
|
||||||
Circuit:
|
|
||||||
* Arduino Robot
|
|
||||||
|
|
||||||
created 1 May 2013
|
|
||||||
by X. Yang
|
|
||||||
modified 12 May 2013
|
|
||||||
by D. Cuartielles
|
|
||||||
|
|
||||||
This example is in the public domain
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ArduinoRobot.h>
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
// initialize the robot
|
|
||||||
Robot.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
void loop() {
|
|
||||||
Robot.turn(50); //turn 50 degrees to the right
|
|
||||||
=======
|
|
||||||
void loop(){
|
|
||||||
Robot.turn(50);//turn 50 degrees to the right
|
|
||||||
Robot.motorsStop();
|
|
||||||
>>>>>>> f062f704463222e83390b4a954e211f0f7e6e66f
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
Robot.turn(-100);//turn 100 degrees to the left
|
|
||||||
Robot.motorsStop();
|
|
||||||
delay(1000);
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
Keyboard Test
|
|
||||||
|
|
||||||
Check how the robot's keyboard works. This example
|
|
||||||
sends the data about the key pressed through the
|
|
||||||
serial port.
|
|
||||||
|
|
||||||
All the buttons on the Control Board are tied up to a
|
|
||||||
single analog input pin, in this way it is possible to multiplex a
|
|
||||||
whole series of buttons on one single pin.
|
|
||||||
|
|
||||||
It is possible to recalibrate the thresholds of the buttons using
|
|
||||||
the Robot.keyboardCalibrate() function, that takes a 5 ints long
|
|
||||||
array as parameter
|
|
||||||
|
|
||||||
Circuit:
|
|
||||||
* Arduino Robot
|
|
||||||
|
|
||||||
created 1 May 2013
|
|
||||||
by X. Yang
|
|
||||||
modified 12 May 2013
|
|
||||||
by D. Cuartielles
|
|
||||||
|
|
||||||
This example is in the public domain
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ArduinoRobot.h>
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// it is possible to use an array to calibrate
|
|
||||||
//int vals[] = { 0, 133, 305, 481, 724 };
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
// initialize the serial port
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
// calibrate the keyboard
|
|
||||||
//Robot.keyboardCalibrate(vals);//For the new robot only.
|
|
||||||
=======
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
>>>>>>> f062f704463222e83390b4a954e211f0f7e6e66f
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
// print out the keyboard readings
|
|
||||||
Serial.println(Robot.keyboardRead());
|
|
||||||
delay(100);
|
|
||||||
}
|
|
Reference in New Issue
Block a user