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
  1. Home
  2. Development
  3. S_INFO NODE with OLED Display - Solved -

S_INFO NODE with OLED Display - Solved -

Scheduled Pinned Locked Moved Development
4 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • scribere8146S Offline
    scribere8146S Offline
    scribere8146
    wrote on last edited by scribere8146
    #1

    Hi, this is my code for writing Text to the oled display.
    Controller is ioBroker and so far everything is working, but... I like to place multiple lines to the display using V_VAR1 - V_VAR5. How to use them?
    And do i need a ACK Command?

    Thanks for you help, sorry this is my first "self made" node.

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.1 - Thorsten Böttcher
     * 
     * DESCRIPTION
     * Example sketch showing how to send messages to 0,96" OLED Display
     * 
     * ****************************
     * 
     *       OLED                 ARDUINO
     *  -----1234-----
     *  |            |  1 ->    3,3 V
     *  |            |  2 ->    GND
     *  |            |  3 -> A5 SCL
     *  |            |  4 -> A4 SDA
     *  --------------
     *  
     *  OLED ASCII Library from https://github.com/greiman/SSD1306Ascii
     *  
     */
     
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    
    #include <SPI.h>
    #include <MySensors.h> 
    
    #define CHILD_ID 0
    
    //oled display 
    #include "SSD1306Ascii.h"
    #include "SSD1306AsciiAvrI2c.h"
    #define I2C_ADDRESS 0x3C
    SSD1306AsciiAvrI2c oled;
    
    // SketchInfo
    static const char SketchName[]    ="Info Display";
    static const char SketchVersion[] ="1.1";
    int PosX     = 0;
    int PosY     = 0;
    int ClrScr   = 0;
    int FontSize = 1;
    
    // loop
    static const uint64_t UPDATE_INTERVAL = 60000;
    
    MyMessage msgText (CHILD_ID, V_TEXT); // Text
    MyMessage msgVar1 (CHILD_ID, V_VAR1); // Cursor PosX
    MyMessage msgVar2 (CHILD_ID, V_VAR2); // Cursor PosY
    MyMessage msgVar3 (CHILD_ID, V_VAR3); // Clear Screen
    MyMessage msgVar4 (CHILD_ID, V_VAR4); // FontSize
    MyMessage msgVar5 (CHILD_ID, V_VAR5); // Not Used
    
    void setup()  
    {  
      Serial.println("starting...");
      ShowInfo();
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo(SketchName, SketchVersion);
      present(CHILD_ID, S_INFO);
    }
    
    void receive(const MyMessage &mymessage)
    {
     if (mymessage.type==V_TEXT) {
       DisplayMessage(mymessage.getString());
      }
     if (mymessage.type==V_VAR1) {
       PosX = atoi(mymessage.getString());
      } 
     if (mymessage.type==V_VAR2) {
        PosY = atoi(mymessage.getString());
      } 
     if (mymessage.type==V_VAR3) {
        ClrScr=atoi(mymessage.getString());
        if ( ClrScr > 0 )
          oled.clear();
      } 
     if (mymessage.type==V_VAR4) {
        oled.set1X();
        FontSize=atoi(mymessage.getString());
        if ( FontSize > 1 )
          oled.set2X();
      } 
    }
    
    void loop()     
    {     
     
      // Wait, but receive messages
      wait(UPDATE_INTERVAL); 
    }
    
    
    void ShowInfo()
    {
      oled.begin(&Adafruit128x64, I2C_ADDRESS);
      oled.setFont(Arial14);  
     
      oled.setFont(Arial14);
      oled.set1X();
      oled.setCursor(20,1);
      oled.write("* MySensors 2.0 *");
      oled.setCursor(30,3);
      oled.write(SketchName);
      oled.write(" ");
      oled.write(SketchVersion);
      oled.setCursor(30,5);
      oled.write("NodeID");
      oled.write(" ");
      oled.print(getNodeId());
      sleep(3000); 
      oled.clear();
    }
    
    void DisplayMessage(const char Message[])
    {
      oled.setCursor(PosX,PosY);
      oled.clearToEOL ();
      oled.write(Message);
    }
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by
      #2

      @awi got some examples in Domoticz: https://forum.mysensors.org/topic/1957/lcd-clock-and-text-sensor-node-with-new-v_text I dont know how this works in ioBroker with v_var though.

      Controller: Proxmox VM - Home Assistant
      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

      1 Reply Last reply
      0
      • scribere8146S Offline
        scribere8146S Offline
        scribere8146
        wrote on last edited by
        #3

        Hi sundberg84, using 5 Nodes was my first idea. But i want to use V_VAR1...
        But you solved me problem indirecty. I installed MYSController and...the code (updated above) is correct.
        Looks like ioBroker is my problem.

        Thanks for your help Thorsten

        1 Reply Last reply
        1
        • scribere8146S Offline
          scribere8146S Offline
          scribere8146
          wrote on last edited by
          #4

          Made small update .....X,Y Pos Fontsize...

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          9

          Online

          12.0k

          Users

          11.2k

          Topics

          113.4k

          Posts


          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

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