File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
java/libraries/io/examples Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -20,18 +20,18 @@ void draw() {
2020void 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
3131float 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
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments