
Zitat von
HaWe
Aber mal eine ganz andere Frage :
Wo in deinem Sketch (void setup() ) startest du denn überhaupt Wire mit Wire.begin() - irgendwie sehe ich es nicht....?
Du hast Recht, den Befehl Wire.begin() gibt es bei mir bisher nicht. Wenn das ein Fehler ist, muß ich das ggf. ändern.
Allerdings hab ich mich beim Aufbau des Code an ein Beispiel aus der originalen "radio.h" Library angelehnt.
Siehe hier:
Code:
#include <Wire.h>
#include <radio.h>
#include <SI4703.h>
#include <RDSParser.h>
SI4703 radio; ///< Create an instance of a SI4703 chip radio.
RDSParser rds; /// get a RDS parser
/// State definition for this radio implementation.
enum RADIO_STATE {
STATE_PARSECOMMAND, ///< waiting for a new command character.
STATE_PARSEINT, ///< waiting for digits for the parameter.
STATE_EXEC ///< executing the command.
};
RADIO_STATE state; ///< The state variable is used for parsing input characters.
/// Update the Frequency on the LCD display.
void DisplayFrequency(RADIO_FREQ f)
{
char s[12];
radio.formatFrequency(s, sizeof(s));
Serial.print("FREQ:"); Serial.println(s);
} // DisplayFrequency()
/// Update the ServiceName text on the LCD display.
void DisplayServiceName(char *name)
{
Serial.print("RDS:");
Serial.println(name);
} // DisplayServiceName()
void RDS_process(uint16_t block1, uint16_t block2, uint16_t block3, uint16_t block4) {
rds.processData(block1, block2, block3, block4);
}
/// Setup a FM only radio configuration with I/O for commands and debugging on the Serial port.
void setup() {
// open the Serial port
Serial.begin(57600);
Serial.print("Radio...");
delay(500);
// Initialize the Radio
radio.init();
// Enable information to the Serial port
radio.debugEnable();
radio.setBandFrequency(RADIO_BAND_FM, 8760);
// delay(100);
radio.setMono(false);
radio.setMute(false);
// radio.debugRegisters();
radio.setVolume(8);
Serial.write('>');
state = STATE_PARSECOMMAND;
// setup the information chain for RDS data.
radio.attachReceiveRDS(RDS_process);
rds.attachServicenNameCallback(DisplayServiceName);
} // Setup
/// Constantly check for serial input commands and trigger command execution.
void loop() {
int newPos;
unsigned long now = millis();
static unsigned long nextFreqTime = 0;
static unsigned long nextRadioInfoTime = 0;
// some internal static values for parsing the input
static char command;
static int16_t value;
static RADIO_FREQ lastf = 0;
RADIO_FREQ f = 0;
char c;
// check for RDS data
radio.checkRDS();
// update the display from time to time
if (now > nextFreqTime) {
f = radio.getFrequency();
if (f != lastf) {
// print current tuned frequency
DisplayFrequency(f);
lastf = f;
} // if
nextFreqTime = now + 400;
} // if
} // loop
// End.
Dort gibt es den Befehl auch nicht. Da es beim Kompilieren keine Probleme gab habe ich vermutet, das die Library "radio.h" das implementiert hat. Eventuell passiert das im Befehl "radio.init()" im Setup?
Ich meine auch andere Beispiele gesehen zu haben, wo das mit dem fehlenden Wire.begin() so ist!?
Gruß Uwe
Lesezeichen