mxchip iot devkit RGB LED and 128 x 64 OLED display examples

7

In this article we look at another couple of features of the mxchip iot devkit, the RGB LED and the 128x 64 OLED display

You can see these on the image of the board below

mxchip

 

Parts

About $41 for the board

seeed studio MXChip AZ3166 IOT Developer Kit Compatible with Arduino

Code

This is for the Arduino IDE once you have added support for the MXChip

This is an OLED display example

#include <OledDisplay.h>
 
void setup(){
    Screen.init();
}
void loop(){
    // print a string to the screen with wrapped = false
    Screen.print("This is OLEDDisplay Testing", false);
    delay(1000);
    // print a string to the screen with wrapped = true
    Screen.print("long string; \nlong string;\nlong string;\nlong string;", true);
    delay(1000);
    for(int i =0; i<=3; i++)
    {
        char buf[100];
        sprintf(buf, "This is row %d", i);
        Screen.print(i, buf);
    }
    delay(1000);
    // clean screen ready for next loop
    Screen.clean();
}

Now for the second example, this is for the RGB LED

#include "RGB_LED.h"
 
RGB_LED rgbLed;
 
uint8_t color[][3] = {
        {255, 0, 0},                // red
        {0, 255, 0},                // green
        {0, 0, 255},                // blue
        {0, 0, 0},
        {255, 255, 0},
        {0, 255, 255},
        {255, 0, 255},
        {255, 255, 255}
    };
void setup()
{
}
 
void loop()
{
    for(int i = 0; i< 8; ++i)
    {
        Serial.printf("Red: %d, Green: %d, Blue: %d\n", color[i][0], color[i][1], color[i][2]);
        rgbLed.setColor(color[i][0], color[i][1], color[i][2]);
        delay(1000);
    }
    Serial.println("Turn off");
    rgbLed.turnOff();
    delay(1000);
}

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.