mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
Modifying examples to use Serial.write() instead of Serial.print(BYTE).
This commit is contained in:
parent
d15e9aa98a
commit
3eae87adc9
@ -38,7 +38,7 @@ void loop()
|
||||
// prints value unaltered, i.e. the raw binary version of the
|
||||
// byte. The serial monitor interprets all bytes as
|
||||
// ASCII, so 33, the first number, will show up as '!'
|
||||
Serial.print(thisByte, BYTE);
|
||||
Serial.write(thisByte);
|
||||
|
||||
Serial.print(", dec: ");
|
||||
// prints value as string as an ASCII-encoded decimal (base 10).
|
||||
|
@ -42,8 +42,8 @@ void loop() {
|
||||
// plays a MIDI note. Doesn't check to see that
|
||||
// cmd is greater than 127, or that data values are less than 127:
|
||||
void noteOn(int cmd, int pitch, int velocity) {
|
||||
Serial.print(cmd, BYTE);
|
||||
Serial.print(pitch, BYTE);
|
||||
Serial.print(velocity, BYTE);
|
||||
Serial.write(cmd);
|
||||
Serial.write(pitch);
|
||||
Serial.write(velocity);
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,6 @@ void loop() {
|
||||
// read from port 1, send to port 0:
|
||||
if (Serial1.available()) {
|
||||
int inByte = Serial1.read();
|
||||
Serial.print(inByte, BYTE);
|
||||
Serial.write(inByte);
|
||||
}
|
||||
}
|
||||
|
@ -52,15 +52,15 @@ void loop()
|
||||
// read switch, map it to 0 or 255L
|
||||
thirdSensor = map(digitalRead(2), 0, 1, 0, 255);
|
||||
// send sensor values:
|
||||
Serial.print(firstSensor, BYTE);
|
||||
Serial.print(secondSensor, BYTE);
|
||||
Serial.print(thirdSensor, BYTE);
|
||||
Serial.write(firstSensor);
|
||||
Serial.write(secondSensor);
|
||||
Serial.write(thirdSensor);
|
||||
}
|
||||
}
|
||||
|
||||
void establishContact() {
|
||||
while (Serial.available() <= 0) {
|
||||
Serial.print('A', BYTE); // send a capital A
|
||||
Serial.print('A'); // send a capital A
|
||||
delay(300);
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,12 @@ void stringCallback(char *myString)
|
||||
|
||||
void sysexCallback(byte command, byte argc, byte*argv)
|
||||
{
|
||||
Serial.print(START_SYSEX, BYTE);
|
||||
Serial.print(command, BYTE);
|
||||
Serial.write(START_SYSEX);
|
||||
Serial.write(command);
|
||||
for(byte i=0; i<argc; i++) {
|
||||
Serial.print(argv[i], BYTE);
|
||||
Serial.write(argv[i]);
|
||||
}
|
||||
Serial.print(END_SYSEX, BYTE);
|
||||
Serial.write(END_SYSEX);
|
||||
}
|
||||
|
||||
void setup()
|
||||
|
@ -71,7 +71,7 @@ void loop() {
|
||||
thisChar = 'a';
|
||||
}
|
||||
// print the character
|
||||
lcd.print(thisChar, BYTE);
|
||||
lcd.write(thisChar);
|
||||
// wait a second:
|
||||
delay(1000);
|
||||
// increment the letter:
|
||||
|
@ -61,7 +61,7 @@ void loop() {
|
||||
// set the cursor position:
|
||||
lcd.setCursor(thisRow,thisCol);
|
||||
// print the letter:
|
||||
lcd.print(thisLetter, BYTE);
|
||||
lcd.write(thisLetter);
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user