Announcement

Collapse
No announcement yet.

uOLED-162g2 with Teensy 3.6

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • superhb
    replied
    This is the closest I've been to getting this working, but I just removed the include for Goldelox_Serial_4DLib and created my own functions based off the ones inside the library. Like so:

    Code:
    void txt_FGcolor (word Color) {
      Serial3.print((char)(F_txt_FGcolour >> 8));
      Serial3.print((char)(F_txt_FGcolour));
      Serial3.print((char)(Color >> 8));
      Serial3.print((char)(Color));
    }
    
    void txt_FontID (word FontNumber) {
      Serial3.print((char)(F_txt_FontID >> 8));
      Serial3.print((char)(F_txt_FontID));
      Serial3.print((char)(FontNumber >> 8));
      Serial3.print((char)(FontNumber));
    }
    
    void gfx_Cls () {
      Serial3.print((char)(F_gfx_Cls >> 8));
      Serial3.print((char)(F_gfx_Cls));
      //GetAck();
    }
    
    void println (const String &s) {
      print(s);
      putCH('\n');
      putCH('\r');
    }
    
    void print (const String &s) {
      int len = s.length();
      char arr[len + 1];
      s.toCharArray(arr, len + 1);
    
      for (int x = 0; x < len; x++) {
        putCH(arr[x]);
      }
    }
    
    void putCH (word wordChar) {
      Serial3.print((char)(F_putCH >> 8));
      Serial3.print((char)(F_putCH));
      Serial3.print((char)(wordChar >> 8));
      Serial3.print((char)(wordChar));
    }
    
    void txt_Width (word multiplier) {
      Serial3.print((char)(F_txt_Width >> 8));
      Serial3.print((char)(F_txt_Width));
      Serial3.print((char)(multiplier >> 8));
      Serial3.print((char)(multiplier));
    }
    
    void txt_Height (word multiplier) {
      Serial3.print((char)(F_txt_Height >> 8));
      Serial3.print((char)(F_txt_Height));
      Serial3.print((char)(multiplier >> 8));
      Serial3.print((char)(multiplier));
    }
    
    void txt_MoveCursor (word line, word column) {
      Serial3.print((char)(F_txt_MoveCursor >> 8));
      Serial3.print((char)(F_txt_MoveCursor));
      Serial3.print((char)(line >> 8));
      Serial3.print((char)(line));
      Serial3.print((char)(column >> 8));
      Serial3.print((char)(column));
    }
    I removed any reference of Goldelox_Serial_4DLib just using Serial3.begin. This isn't currently the best solution as the screen starts off black so I would have to unplug the RX and TX wires, reset the display and then wait for the scrolling text, then plug the wires back in. The first time I did this, it caused the scrolling text to stop and the test text to show up over it. with a miniature green version in the top left of the screen (The text is set to width and height of 2 and the cursor is moved to 3, 0). The next few times it would just return to black, but for a split second the screen would show the test text.

    EDIT: It seems the cause of the screen returning to black is using the gfx_Cls() function.

    EDIT2: Here is the current state of the display after I reset the display manually and plug the wires back in: https://i.imgur.com/ZO9EJZ7.jpg

    Here is my code currently aswell:
    Code:
    #include <Goldelox_Const4D.h>
    #include <Goldelox_Const4DSerial.h>
    #include <Goldelox_Types4D.h>
    
    #define RS 4
    
    void setup () {
      pinMode(RS, OUTPUT);
      resetDisplay();
    
      Serial3.begin(9600);
      Serial3.flush();
    
      //gfx_Cls();
    
      gfx_ScreenMode(LANDSCAPE_R);
    }
    
    void loop () {
      gfx_ScreenMode(LANDSCAPE_R);
    
      //gfx_Cls();
    
      txt_FGcolor(WHITE);
      txt_FontID(SYSTEM);
      txt_Height(2);
      txt_Width(2);
      txt_MoveCursor(3, 0);
      println("Hello World!");
    }
    
    void resetDisplay () {
      digitalWrite(RS, LOW);
      delay(100);
      digitalWrite(RS, HIGH);
      delay(2000);
    }
    
    void gfx_ScreenMode (word ScreenMode) {
      Serial3.print((char)(F_gfx_ScreenMode >> 8));
      Serial3.print((char)(F_gfx_ScreenMode));
      Serial3.print((char)(ScreenMode >> 8));
      Serial3.print((char)(ScreenMode));
    }
    
    void txt_FGcolor (word Color) {
      Serial3.print((char)(F_txt_FGcolour >> 8));
      Serial3.print((char)(F_txt_FGcolour));
      Serial3.print((char)(Color >> 8));
      Serial3.print((char)(Color));
    }
    
    void txt_FontID (word FontNumber) {
      Serial3.print((char)(F_txt_FontID >> 8));
      Serial3.print((char)(F_txt_FontID));
      Serial3.print((char)(FontNumber >> 8));
      Serial3.print((char)(FontNumber));
    }
    
    void gfx_Cls () {
      Serial3.print((char)(F_gfx_Cls >> 8));
      Serial3.print((char)(F_gfx_Cls));
      //GetAck();
    }
    
    void println (const String &s) {
      print(s);
      putCH('\n');
      putCH('\r');
    }
    
    void print (const String &s) {
      int len = s.length();
      char arr[len + 1];
      s.toCharArray(arr, len + 1);
    
      for (int x = 0; x < len; x++) {
        putCH(arr[x]);
      }
    }
    
    void putCH (word wordChar) {
      Serial3.print((char)(F_putCH >> 8));
      Serial3.print((char)(F_putCH));
      Serial3.print((char)(wordChar >> 8));
      Serial3.print((char)(wordChar));
    }
    
    void txt_Width (word multiplier) {
      Serial3.print((char)(F_txt_Width >> 8));
      Serial3.print((char)(F_txt_Width));
      Serial3.print((char)(multiplier >> 8));
      Serial3.print((char)(multiplier));
    }
    
    void txt_Height (word multiplier) {
      Serial3.print((char)(F_txt_Height >> 8));
      Serial3.print((char)(F_txt_Height));
      Serial3.print((char)(multiplier >> 8));
      Serial3.print((char)(multiplier));
    }
    
    void txt_MoveCursor (word line, word column) {
      Serial3.print((char)(F_txt_MoveCursor >> 8));
      Serial3.print((char)(F_txt_MoveCursor));
      Serial3.print((char)(line >> 8));
      Serial3.print((char)(line));
      Serial3.print((char)(column >> 8));
      Serial3.print((char)(column));
    }
    Last edited by superhb; 23 February 2017, 01:02 PM.

    Leave a comment:


  • superhb
    replied
    It seems that when the sketch gets up to Goldelox_Serial_4DLib Display(&Serial3); it just stops working.

    Leave a comment:


  • superhb
    replied
    I have softwareserial commented and i have a define that makes DisplaySerial Serial3

    Leave a comment:


  • tonton81
    replied
    oh dont use software serial look above Goldelox_Serial_4DLib_Display(&Serial3) and comment out software serial.

    Leave a comment:


  • tonton81
    replied
    i have a picasso and a diablo on serial1, and serial2 and theyre working fine, i never played with goldelox tho

    Leave a comment:


  • superhb
    replied
    Originally posted by tonton81 View Post
    are you wiring RX lcd to TX(pin8) teensy and TX lcd to RX(pin7) teensy?
    Yes. I have everything wired correctly

    Leave a comment:


  • tonton81
    replied
    are you wiring RX lcd to TX(pin8) teensy and TX lcd to RX(pin7) teensy?

    Leave a comment:


  • superhb
    replied
    I have the display wired to pin 8 and 7. But nothing happens when I try to set the displayserial to Serial3.

    Leave a comment:


  • tonton81
    replied
    sorry but 7&8 are actually serial3, serial 2 is 9&10, 31&32 is serial4

    teensy 3.5&3.6 have 6 uarts, the native usb is not included in those and native usb is "Serial." the pinout value on the teensy card is the actual Serial, so RX2/TX2 is Serial2

    Leave a comment:


  • Noel
    replied
    Dear superhb,

    You can use Serial3 but the pins of RX and TX are 7 and 8 in the teensy 3.6 . Serial2 on the contrary uses pin 9 and 10.
    So you can declare it like this:
    Goldelox_Serial_4DLib_Display(&Serial2) and connect the 4D LCD to pins 9 (RX) and 10 (TX).

    Here is the pinout for teensy 3.6 --> https://www.pjrc.com/teensy/pinout.html. Thanks tonton81.

    Best regards,
    Last edited by Noel; 22 February 2017, 05:28 PM.

    Leave a comment:


  • superhb
    replied
    I redid the code like so
    Code:
    #include <Goldelox_Const4D.h>
    #include <Goldelox_Const4DSerial.h>
    #include <Goldelox_Serial_4DLib.h>
    #include <Goldelox_Types4D.h>
    #include <SoftwareSerial.h>
    
    #define RS 4
    
    //#define DisplaySerial Serial3
    /* Display  Teensy
     * TX 3     7
     * RX 5     8
     */
    SoftwareSerial DisplaySerial(8, 7);
    Goldelox_Serial_4DLib Display(&DisplaySerial);
    
    void setup () {
      pinMode(RS, OUTPUT);
      resetDisplay();
    
      Display.TimeLimit4D = 5000; // 2 second timeout on commands
      DisplaySerial.begin(9600);
      Display.gfx_Cls();
    }
    
    void loop () {
      Display.gfx_Cls();
      Display.println("Hello World!");
    }
    
    void resetDisplay () {
      digitalWrite(RS, LOW);
      delay(100);
      digitalWrite(RS, HIGH);
      delay(2000);
    }
    Its interesting because with SoftwareSerial like so, the display actually resets. but if I change it to 'SoftwareSerial DisplaySerial(7, 8);' it won't reset the screen. Also if I switch to Serial3 it doesn't reset either.

    Leave a comment:


  • superhb
    replied
    Originally posted by tonton81 View Post
    do you have the full sketch ? were just looking at errors on that site
    Well I'm just using the GoldeloxBigDemo and I'm not at my computer at the moment here is the sketch from their github: https://github.com/4dsystems/Goldelo...loxBigDemo.ino the only thing different is that DisplaySerial is Serial3

    Leave a comment:


  • tonton81
    replied
    do you have the full sketch ? were just looking at errors on that site

    Leave a comment:


  • superhb
    started a topic uOLED-162g2 with Teensy 3.6

    uOLED-162g2 with Teensy 3.6

    I have my uOLED-162g2 connected to Serial3 and the reset pin connected to pin 4. I'm just trying to use the GoldeloxBigDemo that came with the library and it doesn't seem to be reseting the display either. I tried to manually reset it and it still does the scrolling words thing. When I upload the code this shows up on the IDE: http://pastebin.com/aXY3UiT0
Working...
X