Pages: [1]   Go Down
Author Topic: What is used instead of BYTE?  (Read 1199 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Error is "The BYTE keyword is no longer supported"



Quote
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3

SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
void setup() {
  Serial.begin(9600);
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  
  mySerial.begin(9600);
}
void loop(){
  mySerial.print(0, BYTE);
  Serial.print("HELLO");
  
  delay(100);
}


Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

 try short or uint8_t

Duane B

rcarduino.blogspot.com
Logged


Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  mySerial.print(0, BYTE);
==>
Code:
mySerial.write((byte)0);
as has been posted MANY times.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks how do i search for things like that? I have looked for it a lot.
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 91
Posts: 4681
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's AVR Libc Modules with a lot of particulars:
http://www.nongnu.org/avr-libc/user-manual/modules.html

That's on the home site for the C++ Arduino uses.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

in my code above how do i replace the "Hello" with the actual serial string the sabertooth is seeing? so i can debug with my monitor?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 473
Posts: 18695
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks how do i search for things like that? I have looked for it a lot.

You could try Googling:

Code:
"The BYTE keyword is no longer supported" +arduino

Second hit led to: http://wyolum.com/?p=624

On that page:

Quote
Upgrading to Arduino 1.0

ISSUE #1: ”BYTE” keyword is no longer supported ...
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 91
Posts: 4681
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

in my code above how do i replace the "Hello" with the actual serial string the sabertooth is seeing? so i can debug with my monitor?

You make a byte array to hold the incoming characters and then in loop() you watch for then serial data, get it (I find it best to get 1 character at a time, you may loop() many times between characters arriving. There's time to do other things between if you want/need.) and add it to the byte array (I use a byte variable to know what array index to fill next, starts with 0, and increment that each time I add a new character.) and when it's done (Aha! How to know when? Hang on!) add a 0 byte to terminate the string in the byte array. The byte array then holds the string to print.

------------------------------------------
How to know when to end the word or line? Lots of ways for lots of needs.

Worst case for end of line is if too much time has passed since the last character arrived then the line must be finished. That's terrible code though and really asking for trouble but hey you might get away with it for a long time. I actually did use that in code to read electric meter output but there are so many error checks on the data that I catch and handle errors... by dumping the data message as bad and getting the next one.

In Serial Monitor I set it up so that each line sent gets a carriage return added but you can go with new line, carriage return, both or the default which is nothing. It gives me an end stop.

If I expect multiple data items sent then I separate them with delimiters like space, comma, semi-colon, etc, and watch for those in my code... the delimiter is my end of word marker. Using different markers can give you extra error checking since serial transmission is not guaranteed.

When you see strings as arrays and serial data as 1 byte telegrams, simple approaches should become clear to you. Can you compare two strings in two arrays without using strcmp()? Certainly! The same way that strcmp() does! If the bytes at each array position are the same until both are zero (end of a C string is always 0) then the strings are equal. And look Ma, no library!
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Pages: [1]   Go Up
Jump to: