Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
vikmadV

vikmad

@vikmad
About
Posts
4
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Serial gateway using Arduino Mega, how to set what serial to use ?
    vikmadV vikmad

    On my Arduino Mega works for me this:

    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    //#define MY_DEBUG_HWSERIAL Serial // = Serial0 / Rx0 & Tx0 to programming & debug 
    
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    #define MY_SERIALDEVICE Serial3 // Rx3 & Tx3 to Gateway
    
    
    // Enable RS485 transport layer
    #define MY_RS485
    #define MY_RS485_HWSERIAL Serial1 // Rx1 & Tx1 to RS485 network 
    #define MY_RS485_BAUD_RATE 9600
    #define MY_RS485_DE_PIN 22
    

    I tried to edit a library MyHwAVR.cpp for MY_DEBUG_HWSERIAL, but without any positive result.:

    #ifdef MY_DEBUG
    #ifndef MY_DEBUG_HWSERIAL
    #define MY_DEBUG_HWSERIAL MY_SERIALDEVICE
    #endif
    void hwDebugPrint(const char *fmt, ... )
    {
    	char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
    #ifdef MY_GATEWAY_FEATURE
    	// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
    	snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
    	MY_DEBUG_HWSERIAL.print(fmtBuffer);
    #else
    	// prepend timestamp (AVR nodes)
    	MY_DEBUG_HWSERIAL.print(hwMillis());
    	MY_DEBUG_HWSERIAL.print(" ");
    #endif
    	va_list args;
    	va_start (args, fmt );
    #ifdef MY_GATEWAY_FEATURE
    	// Truncate message if this is gateway node
    	vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
    	fmtBuffer[sizeof(fmtBuffer) - 2] = '\n';
    	fmtBuffer[sizeof(fmtBuffer) - 1] = '\0';
    #else
    	vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
    #endif
    	va_end (args);
    	MY_DEBUG_HWSERIAL.print(fmtBuffer);
    	MY_DEBUG_HWSERIAL.flush();
    
    	//MY_DEBUG_HWSERIAL.write(freeRam());
    }
    #endif
    

    The code above does not work!

    Hardware

  • rs485 on nano
    vikmadV vikmad

    @dbemowsk It works now. To sketch, I added the line: #define MY_NODE_ID xx

    Arduino IDE 1.8.1, MySensors Library v2.1.1:

    • Upload ClearEepromConfig
    • Upload MotionSensorRS485
      = not working

    • Add #define MY_NODE_ID 1 to MotionSensorRS485 and upload
      = working

    General Discussion

  • rs485 on nano
    vikmadV vikmad

    Many hours I solved why MySe485 example does not work :angry: ... I tried Mega, Uno, Mini, Nano, reinstallation of IDE, libraries, ClearEepromConfig, HWserial / AltSoftSerial / direct (Tx <> Rx) + (Rx <> TX) without MAX485 ...

    The other day I came across this forum and the solution is:

    #define MY_NODE_ID xx

    I saw a bug that RS485 communication is bad, because it is illegible. My mistake, the communication between GW and the node is not readable ASCII ...

    RS485 communication: Node waiting to GW respone:
    0_1485894929734_upload-fb5458be-c704-4c5a-9377-61558ce658c5

    General Discussion

  • MySensors with Atmega8(L) ?
    vikmadV vikmad

    // EDIT and ADD in: ...Arduino\libraries\MySensors\drivers\AVR\DigitalIO\DigitalPin.h

        #if defined(__AVR_ATmega168__)\
        ||defined(__AVR_ATmega168P__)\
        ||defined(__AVR_ATmega8__)\
        ||defined(__AVR_ATmega328P__)
        // 168 and 328 Arduinos
    

    // EDIT and ADD IN: ...Arduino\libraries\MySensors\drivers\AVR\DigitalWriteFast\digitalWriteFast.h

     #elif defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_DUEMILANOVE) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328PB__)
    

    // ADD to Sketch Code:

    //Name conversion R.Wiersma
    #define UCSR0A UCSRA
    #define UDR0 UDR
    #define UDRE0 UDRE
    #define RXC0 RXC
    #define FE0 FE
    #define TIFR1 TIFR
    #define WDTCSR WDTCR

    #define WDIE 6
    #define WDCE 4

    // DISABLE debug! small memory :(
    //#define MY_DEBUG

    I did not test on HW, I just tried to compile it (DimmableLEDActuator):

    0_1484920625423_obrazek.png

    General Discussion
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular