Skip to content

Commit 3ddf2d7

Browse files
committed
I/O: Remove casts to byte from example sketches
1 parent edf411e commit 3ddf2d7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

java/libraries/io/examples/I2CCompass/I2CCompass.pde

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ void draw() {
2020
void setHeadingMode() {
2121
i2c.beginTransmission(0x21);
2222
// command byte for writing to EEPROM
23-
i2c.write((byte) 0x77);
23+
i2c.write(0x77);
2424
// address of the output data control byte
25-
i2c.write((byte) 0x4e);
25+
i2c.write(0x4e);
2626
// give us the plain heading
27-
i2c.write((byte) 0x00);
27+
i2c.write(0x00);
2828
i2c.endTransmission();
2929
}
3030

3131
float getHeading() {
3232
i2c.beginTransmission(0x21);
3333
// command byte for reading the data
34-
i2c.write((byte) 0x41);
34+
i2c.write(0x41);
3535
byte[] in = i2c.read(2);
3636
i2c.endTransmission();
3737
// put bytes together to tenth of degrees

java/libraries/io/examples/I2CDigitalAnalog/I2CDigitalAnalog.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void setAnalog(float fac) {
2121
// convert to 12 bit value
2222
int val = int(4095 * fac);
2323
i2c.beginTransmission(0x60);
24-
i2c.write((byte) (val >> 8));
25-
i2c.write((byte) (val & 255));
24+
i2c.write(val >> 8);
25+
i2c.write(val & 255);
2626
i2c.endTransmission();
2727
}

java/libraries/io/examples/I2CDigitalAnalogOOP/MCP4725.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class MCP4725 extends I2C {
2020
// convert to 12 bit value
2121
int val = int(4095 * fac);
2222
beginTransmission(address);
23-
write((byte) (val >> 8));
24-
write((byte) (val & 255));
23+
write(val >> 8);
24+
write(val & 255);
2525
endTransmission();
2626
}
2727
}

0 commit comments

Comments
 (0)