1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

examples: format all .ino files

This formats all the example source files using Arduino style rules.
This commit is contained in:
Ivan Grokhotkov
2018-02-19 18:30:59 +03:00
committed by Ivan Grokhotkov
parent e226251b27
commit 61cd8d8385
88 changed files with 2730 additions and 2801 deletions

View File

@ -1,19 +1,19 @@
/*
* EEPROM Clear
*
* Sets all of the bytes of the EEPROM to 0.
* This example code is in the public domain.
EEPROM Clear
*/
Sets all of the bytes of the EEPROM to 0.
This example code is in the public domain.
*/
#include <EEPROM.h>
void setup()
{
void setup() {
EEPROM.begin(512);
// write a 0 to all 512 bytes of the EEPROM
for (int i = 0; i < 512; i++)
for (int i = 0; i < 512; i++) {
EEPROM.write(i, 0);
}
// turn the LED on when we're done
pinMode(13, OUTPUT);
@ -21,6 +21,5 @@ void setup()
EEPROM.end();
}
void loop()
{
void loop() {
}

View File

@ -1,10 +1,10 @@
/*
* EEPROM Read
*
* Reads the value of each byte of the EEPROM and prints it
* to the computer.
* This example code is in the public domain.
*/
EEPROM Read
Reads the value of each byte of the EEPROM and prints it
to the computer.
This example code is in the public domain.
*/
#include <EEPROM.h>
@ -12,8 +12,7 @@
int address = 0;
byte value;
void setup()
{
void setup() {
// initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
@ -22,8 +21,7 @@ void setup()
EEPROM.begin(512);
}
void loop()
{
void loop() {
// read a byte from the current address of the EEPROM
value = EEPROM.read(address);
@ -37,8 +35,9 @@ void loop()
// there are only 512 bytes of EEPROM, from 0 to 511, so if we're
// on address 512, wrap around to address 0
if (address == 512)
if (address == 512) {
address = 0;
}
delay(500);
}

View File

@ -1,10 +1,10 @@
/*
* EEPROM Write
*
* Stores values read from analog input 0 into the EEPROM.
* These values will stay in the EEPROM when the board is
* turned off and may be retrieved later by another sketch.
*/
EEPROM Write
Stores values read from analog input 0 into the EEPROM.
These values will stay in the EEPROM when the board is
turned off and may be retrieved later by another sketch.
*/
#include <EEPROM.h>
@ -12,13 +12,11 @@
// we're going to write to next)
int addr = 0;
void setup()
{
void setup() {
EEPROM.begin(512);
}
void loop()
{
void loop() {
// need to divide by 4 because analog inputs range from
// 0 to 1023 and each byte of the EEPROM can only hold a
// value from 0 to 255.
@ -33,8 +31,7 @@ void loop()
// the EEPROM, so go back to 0 when we hit 512.
// save all changes to the flash.
addr = addr + 1;
if (addr == 512)
{
if (addr == 512) {
addr = 0;
EEPROM.commit();
}