nodo-domotica.nl

old school nodo spin off

Alles over domotica wat NIET over de nodo gaat

old school nodo spin off

Berichtdoor viki » 06 okt 2013, 16:14

Hallo iedereen,

Een jaar geleden kwam ik toevallig de oude website van nodo tegen http://goo.gl/t8G9Du. Ik was zo dol op het idee en liep direct met het boodschappenlijstje naar de plaatselijke electronica boer.

Eens thuis was mijn ethousiasme ineens stukken minder. Ik stak het ineen en begon te testen en ik kwam de ene fout na de andere tegen in mijn arduino compiler. Verdere research op het web bracht mij op deze nieuwe site waar ik het slechte nieuws vernam dat het nodo project een overstap deed van uno naar mega.

Aanpassingen brachten mij nergens dus begon ik terug vanaf nul. Ik begon eerst met mijn RF en stak mijn licht hier op http://goo.gl/4DqKaz

Na wat testen op mijn breadboard en met fuzzillogic kreeg ik het aan de praat en kon ik mijn lampen bedienen.

Ik had de code van mijn afstandbediening ingelezen en kon zo mijn eigen remote genereren en zo mijn ontvangers dit aanleren. Het resultaat was prachtig, ik kon zowel mijn oude afstandsbediening gebruiken en arduino om het licht aan en uit de doen.

Foto's van mijn arduino + mijn viki shield :p . (mijn eerste soldeer werk.... ever...)
http://goo.gl/xZ3Ilz

Nu werkt alles. Maar waarom deze post ? :p

Ik wou er ook ir aan toevoegen om zo mijn tv en projector te kunnen bedienen. Een tijd geleden is mijn hdd gecrashed en ben ik mijn oude sketch kwijtgeraakt. Ik begon opnieuw van nul via het example van fuzzillogic maar krijg weer errors in mijn compiler die ik niet opgelost krijg. Hopelijk kan ik hier terecht met mijn probleem hoewel het hier niet over nodo gaat.

Ik probeer hier mijn afstandsbediening in te lezen.

Code: Selecteer alles
MAIN.cpp
/*
* Demo for RF remote switch receiver.
* This example is for the new KaKu / Home Easy type of remotes!

* For details, see NewRemoteReceiver.h!
*
* This sketch shows the received signals on the serial port.
* Connect the receiver to digital pin 2.
*/

#include <C:\Users\timur\Desktop\arduino-1.0-windows\arduino-1.0\libraries\rf\NewRemoteSwitch\NewRemoteReceiver.h>

void setup() {
  Serial.begin(115200);
 
  // Initialize receiver on interrupt 0 (= digital pin 2), calls the callback "showCode"
  // after 2 identical codes have been received in a row. (thus, keep the button pressed
  // for a moment)
  //
  // See the interrupt-parameter of attachInterrupt for possible values (and pins)
  // to connect the receiver.
  NewRemoteReceiver::init(0, 2, showCode);
}

void loop() {
}

// Callback function is called only when a valid code is received.
void showCode(NewRemoteCode receivedCode) {
  // Note: interrupts are disabled. You can re-enable them if needed.
 
  // Print the received code.
  Serial.print("Addr ");
  Serial.print(receivedCode.address);
 
  if (receivedCode.groupBit) {
    Serial.print(" group");
  } else {
    Serial.print(" unit ");
    Serial.print(receivedCode.unit);
  }
 
  switch (receivedCode.switchType) {
    case NewRemoteCode::off:
      Serial.print(" off");
      break;
    case NewRemoteCode::on:
      Serial.print(" on");
      break;
    case NewRemoteCode::dim:
      Serial.print(" dim level ");
      Serial.print(receivedCode.dimLevel);
      break;
    case NewRemoteCode::on_with_dim:
      Serial.print(" on with dim level ");
      Serial.print(receivedCode.dimLevel);
      break;
  }
 
  Serial.print(", period: ");
  Serial.print(receivedCode.period);
  Serial.println("us.");
}



Code: Selecteer alles
NewRemoteReceiver.h


/*
 * NewRemoteSwitch library v1.1.0 (20130601) made by Randy Simons http://randysimons.nl/
 *
 * License: GPLv3. See license.txt
 */

#ifndef NewRemoteReceiver_h
#define NewRemoteReceiver_h

#include <Arduino.h>

struct NewRemoteCode {
   enum SwitchType {
      off = 0,
      on = 1,
      dim = 2,
      on_with_dim = 3
   };

   unsigned int period;      // Detected duration in microseconds of 1T in the received signal
   unsigned long address;      // Address of received code. [0..2^26-1]
   boolean groupBit;         // Group bit set or not
   SwitchType switchType;      // off, on, dim, on_with_dim.
   byte unit;               // Unit code of received code [0..15]
   byte dimLevel;            // Dim level [0..15] iff switchType == 2
};

typedef void (*NewRemoteReceiverCallBack)(NewRemoteCode);

/**
* See RemoteSwitch for introduction.
*
* NewRemoteReceiver decodes the signal received from a 433MHz-receiver, like the "KlikAanKlikUit"-system
* as well as the signal sent by the RemoteSwtich class. When a correct signal is received,
* a user-defined callback function is called.
*
* Note that in the callback function, the interrupts are still disabled. You can enabled them, if needed.
* A call to the callback must be finished before NewRemoteReceiver will call the callback function again, thus
* there is no re-entrant problem.
*
* When sending your own code using NewRemoteSwich, disable() the receiver first.
*
* This is a pure static class, for simplicity and to limit memory-use.
*/

class NewRemoteReceiver {
   public:
      /**
      * Initializes the decoder.
      *
      * If interrupt >= 0, init will register pin <interrupt> to this library.
      * If interrupt < 0, no interrupt is registered. In that case, you have to call interruptHandler()
      * yourself whenever the output of the receiver changes, or you can use InterruptChain.
      *
      * @param interrupt    The interrupt as is used by Arduino's attachInterrupt function. See attachInterrupt for details.
                     If < 0, you must call interruptHandler() yourself.
      * @param minRepeats The number of times the same code must be received in a row before the callback is calles
      * @param callback Pointer to a callback function, with signature void (*func)(NewRemoteCode)
      */
      static void init(int8_t interrupt, byte minRepeats, NewRemoteReceiverCallBack callback);

      /**
      * Enable decoding. No need to call enable() after init().
      */
      static void enable();

      /**
      * Disable decoding. You can re-enable decoding by calling enable();
      */
      static void disable();

      /**
      * Deinitializes the decoder. Disables decoding and detaches the interrupt handler. If you want to
      * re-enable decoding, call init() again.
      */
      static void deinit();

      /**
      * Tells wether a signal is being received. If a compatible signal is detected within the time out, isReceiving returns true.
      * Since it makes no sense to transmit while another transmitter is active, it's best to wait for isReceiving() to false.
      * By default it waits for 150ms, in which a (relative slow) KaKu signal can be broadcasted three times.
      *
      * Note: isReceiving() depends on interrupts enabled. Thus, when disabled()'ed, or when interrupts are disabled (as is
      * the case in the callback), isReceiving() will not work properly.
      *
      * @param waitMillis number of milliseconds to monitor for signal.
      * @return boolean If after waitMillis no signal was being processed, returns false. If before expiration a signal was being processed, returns true.
      */
      static boolean isReceiving(int waitMillis = 150);

      /**
       * Called every time the signal level changes (high to low or vice versa). Usually called by interrupt.
       */
      static void interruptHandler();

   private:

      static int8_t _interrupt;               // Radio input interrupt
      volatile static short _state;            // State of decoding process.
      static byte _minRepeats;
      static NewRemoteReceiverCallBack _callback;
      static boolean _inCallback;               // When true, the callback function is being executed; prevents re-entrance.
      static boolean _enabled;               // If true, monitoring and decoding is enabled. If false, interruptHandler will return immediately.

};

#endif




en dit is de foutmelding die ik krijg.

Code: Selecteer alles
ShowReceivedCode.cpp.o: In function `setup':
C:\Users\timur\AppData\Local\Temp\build2274760930451209073.tmp/ShowReceivedCode.cpp:26: undefined reference to `NewRemoteReceiver::init(signed char, unsigned char, void (*)(NewRemoteCode))'


Wat gaat hier mis?

Alvast bedankt voor al jullie hulp :)

Grtz

Timur
viki
 
Berichten: 1
Geregistreerd: 06 okt 2013, 11:50

Keer terug naar Overige domotica

Wie is er online?

Gebruikers in dit forum: Geen geregistreerde gebruikers. en 1 gast

cron