Arduino Serial Base Class

This page explains how to add a Serial Base Class to the Arduino Serial classes.

What is a Base Class?

A Base Class lays down some guidelines for how you build a bunch of related classes. In our case we're using serial classes. The base class will give us a set of methods that are available in all of the classes that are based upon it.

Why a Serial Base Class?

The short answer: to make things easier.

The long answer: there are a lot of confusing bits when it comes to interfacing with a serial device. Using a Serial Base Class for the serial devices on the Arduino will allow for better hardware abstraction. This way, we don't need to know exactly how a device is connected to our hardware - but we will be able to talk to it in the same way if it were connected to a hardware serial pin or a software serial pin.

How do I add a Serial Base Class?

OK. You've read the stuff above, and you're thinking, “what a bunch of mumbo-jumbo. I don't care. How do I add this silly thing?”. Well you're in luck. Here are the steps:

Arduino IDE V0021+

After collaboration with the people of the Arduino development mailing list, the name of the base class was changed from SerialBase to Stream. Unfortunately, there is still a problem with the Arduino core, so you still need download a modified version.

  1. Install into SKETCHBOOK/hardware folder (create the hardware folder if it doesn't exist).
  2. Start the IDE and select one of the ”(Stream)” version of your board from the Tools|Board menu.
  3. NewSoftSerial and other libraries with Stream modifications can be downloaded from here.

Arduino IDE V0019-0020

These Arduino Versions are messed up. Don't download them.

Arduino IDE V0018

  1. Install into SKETCHBOOK/hardware folder (create the hardware folder if it doesn't exist).
  2. Start the IDE and select one of the ”(SerialBase)” version of your board from the Tools|Board menu.
  3. NewSoftSerial and other libraries with SerialBase modifications can be downloaded from here.

Arduino IDE Versions prior to V0018

  1. Add SerialBase.h to your arduino/hardware/cores/arduino folder.
  2. Make some small changes to HardwareSerial.cpp and HardwareSerial.h in arduino/hardware/cores/arduino.
  3. If you're using NewSoftSerial, you'll need to make some similar changes.

To make it easier, I've already made the changes and they can be downloaded from:

Google Code - Rogue Robotics Libraries for Arduino

SerialBase.h, HardwareSerial.h, HardwareSerial.cpparduino/hardware/cores/arduino.

The modified NewSoftSerial library can replace your existing NewSoftSerial library in arduino/hardware/libraries.

After that, you're ready to go!

Discussion

mowcius, 2010/09/06 17:03

How's this working on 0019, is it still the same as on 0018?

I have also been having some issues and I can't remember what I've done/not done.

Error:

sketch_sep06a.cpp: In function 'void doLCDSpec()':

sketch_sep06a:120: error: 'class RogueMP3' has no member named 'getspectrumanalyzer'

sketch_sep06a.cpp: In function 'void playTrack()':

sketch_sep06a:180: error: 'class RogueSD' has no member named 'entrytofilename'

sketch_sep06a:185: error: 'class RogueMP3' has no member named 'setspectrumanalyzer'

Thanks,

Mowcius

Brett Hagman, 2010/10/18 00:36

Added the information for Arduino IDE 0021.

RE: the RogueSD and RogueMP3 errors you're getting, you need to download the latest versions of the libraries (V0004+ and V0003+ respectively).

b

Don Burns, 2010/10/31 23:42

I have an Arduino Mega board with the Rogue rMP3 shield. I've been trying to download the correct versions and fixes of the software and libraries in order to get the XMAS sample program to work. I'm getting the following error: no matching function for call to 'RogueMP3::RogueMP3(NewSoftSerial&)'C:\Program Files\Arduino\arduino-0018\libraries\RogueMP3/RogueMP3.h:114: note: candidates are: RogueMP3::RogueMP3(SerialBase&)

C:\Program Files\Arduino\arduino-0018\libraries\RogueMP3/RogueMP3.h:107: note: RogueMP3::RogueMP3(const RogueMP3&)

Would it be possible for me to download or receive by email a zipped copy of all the directories and files nessasary to establish communication?

Brett Hagman, 2010/11/01 02:11

Hi Don,

The Arduino Mega should be a snap. Use one of the hardware serial ports instead. Use the rMP3 on an Arduino Mega example to help.

If you need any more help, just email support@roguerobotics.com.

b

Enter your comment
 
  • Bookmark at
  • Bookmark "Arduino Serial Base Class" at del.icio.us
  • Bookmark "Arduino Serial Base Class" at Digg
  • Bookmark "Arduino Serial Base Class" at Google
  • Bookmark "Arduino Serial Base Class" at StumbleUpon
  • Bookmark "Arduino Serial Base Class" at Technorati
  • Bookmark "Arduino Serial Base Class" at Facebook
  • Bookmark "Arduino Serial Base Class" at Twitter
  • Bookmark "Arduino Serial Base Class" at Slashdot
  • Bookmark "Arduino Serial Base Class" at Yahoo! Bookmarks
  • Bookmark "Arduino Serial Base Class" at Furl
  • Bookmark "Arduino Serial Base Class" at Reddit
  • Bookmark "Arduino Serial Base Class" at Ask
  • Bookmark "Arduino Serial Base Class" at BlinkList
  • Bookmark "Arduino Serial Base Class" at blogmarks
  • Bookmark "Arduino Serial Base Class" at Ma.gnolia
  • Bookmark "Arduino Serial Base Class" at Netscape
  • Bookmark "Arduino Serial Base Class" at ppnow
  • Bookmark "Arduino Serial Base Class" at Rojo
  • Bookmark "Arduino Serial Base Class" at Shadows
  • Bookmark "Arduino Serial Base Class" at Simpy
  • Bookmark "Arduino Serial Base Class" at Socializer
  • Bookmark "Arduino Serial Base Class" at Spurl
  • Bookmark "Arduino Serial Base Class" at Tailrank
  • Bookmark "Arduino Serial Base Class" at Live Bookmarks
  • Bookmark "Arduino Serial Base Class" at Wists
  • Bookmark "Arduino Serial Base Class" at Yahoo! Myweb
  • Bookmark "Arduino Serial Base Class" at BobrDobr
  • Bookmark "Arduino Serial Base Class" at Memori
  • Bookmark "Arduino Serial Base Class" at Faves
  • Bookmark "Arduino Serial Base Class" at Favorites
  • Bookmark "Arduino Serial Base Class" at Newsvine
  • Bookmark "Arduino Serial Base Class" at myAOL
  • Bookmark "Arduino Serial Base Class" at Fark
  • Bookmark "Arduino Serial Base Class" at RawSugar
  • Bookmark "Arduino Serial Base Class" at LinkaGoGo
  • Bookmark "Arduino Serial Base Class" at Mister Wong
  • Bookmark "Arduino Serial Base Class" at Wink
  • Bookmark "Arduino Serial Base Class" at BackFlip
  • Bookmark "Arduino Serial Base Class" at Diigo
  • Bookmark "Arduino Serial Base Class" at Segnalo
  • Bookmark "Arduino Serial Base Class" at Netvouz
  • Bookmark "Arduino Serial Base Class" at DropJack
  • Bookmark "Arduino Serial Base Class" at Feed Me Links
  • Bookmark "Arduino Serial Base Class" at funP
  • Bookmark "Arduino Serial Base Class" at HEMiDEMi
code/arduino_serial_base_class.txt · Last modified: 2010/10/18 00:33 by bhagman
Valid CSS Recent changes RSS feed Valid XHTML 1.0