This page explains how to add a Serial Base Class to the Arduino Serial classes.
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.
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.
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:
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.
SKETCHBOOK/hardware folder (create the hardware folder if it doesn't exist).These Arduino Versions are messed up. Don't download them.
SKETCHBOOK/hardware folder (create the hardware folder if it doesn't exist).SerialBase.h to your arduino/hardware/cores/arduino folder.HardwareSerial.cpp and HardwareSerial.h in arduino/hardware/cores/arduino.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.cpp → arduino/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
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
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
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?
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