0
#define ANALOG_IN 0
void setup() {
 Serial.begin(19200);
 analogReference(INTERNAL);
}
void loop() {
 int val = analogRead(ANALOG_IN);
 Serial.print(0xff, byte);
 Serial.print( (val >> 8) & 0xff, byte);
 Serial.print( val & 0xff, byte);
}

This is my code and I'm getting this error for all 3 Serial.print commands. Please help.

Nick Gammon
38.9k13 gold badges69 silver badges125 bronze badges
asked Mar 3, 2018 at 5:58
1
  • if you want to send a byte use Serial.write() Commented Mar 3, 2018 at 6:44

1 Answer 1

1

Why are you putting byte there? That isn't in the Serial.print reference page.

This compiles OK:

#define ANALOG_IN 0
void setup() {
 Serial.begin(19200);
 analogReference(INTERNAL);
}
void loop() {
 int val = analogRead(ANALOG_IN);
 Serial.print(0xff);
 Serial.print( (val >> 8) & 0xff);
 Serial.print( val & 0xff);
}
answered Mar 3, 2018 at 6:23
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.