Skip to content

Commit

Permalink
Get rid of compiler warnings
Browse files Browse the repository at this point in the history
Comparison between signed and unsigned int
  • Loading branch information
MCUdude committed Apr 4, 2019
1 parent 30c3ad2 commit fbf3fec
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void setup() {
This will make your code portable to all AVR processors.
***/

for (int i = 0 ; i < EEPROM.length() ; i++) {
for (unsigned int i = 0 ; i < EEPROM.length() ; i++) {
EEPROM.write(i, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion avr/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ unsigned long eeprom_crc(void) {

unsigned long crc = ~0L;

for (int index = 0 ; index < EEPROM.length() ; ++index) {
for (unsigned int index = 0 ; index < EEPROM.length() ; ++index) {
crc = crc_table[(crc ^ EEPROM[index]) & 0x0f] ^ (crc >> 4);
crc = crc_table[(crc ^ (EEPROM[index] >> 4)) & 0x0f] ^ (crc >> 4);
crc = ~crc;
Expand Down
2 changes: 1 addition & 1 deletion avr/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
void setup() {

float f = 0.00f; //Variable to store data read from EEPROM.
int eeAddress = 0; //EEPROM address to start reading from
unsigned int eeAddress = 0; //EEPROM address to start reading from

Serial.begin(9600);
while (!Serial) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void setup() {
Iterate the EEPROM using a for loop.
***/

for (int index = 0 ; index < EEPROM.length() ; index++) {
for (unsigned int index = 0 ; index < EEPROM.length() ; index++) {

//Add one to each cell in the EEPROM
EEPROM[ index ] += 1;
Expand All @@ -29,7 +29,7 @@ void setup() {
Iterate the EEPROM using a while loop.
***/

int index = 0;
unsigned int index = 0;

while (index < EEPROM.length()) {

Expand All @@ -42,7 +42,7 @@ void setup() {
Iterate the EEPROM using a do-while loop.
***/

int idx = 0; //Used 'idx' to avoid name conflict with 'index' above.
unsigned int idx = 0; //Used 'idx' to avoid name conflict with 'index' above.

do {

Expand All @@ -54,4 +54,4 @@ void setup() {

} //End of setup function.

void loop() {}
void loop() {}
2 changes: 1 addition & 1 deletion avr/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <EEPROM.h>

// start reading from the first byte (address 0) of the EEPROM
int address = 0;
unsigned int address = 0;
byte value;

void setup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <EEPROM.h>

/** the current address in the EEPROM (i.e. which byte we're going to write to next) **/
int address = 0;
unsigned int address = 0;

void setup() {
/** EMpty setup **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <EEPROM.h>

/** the current address in the EEPROM (i.e. which byte we're going to write to next) **/
int addr = 0;
unsigned int addr = 0;

void setup() {
/** Empty setup. **/
Expand Down

0 comments on commit fbf3fec

Please sign in to comment.