Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. ChrisWR
    3. Best
    • Continue chat with ChrisWR
    • Start new chat with ChrisWR
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Best posts made by ChrisWR

    • RE: Micro-Bit

      0_1576573394655_Image1.jpg

      posted in PROJECTS
      ChrisWR
    • M5-bit (Micro-Bit) part 2

      Turn your Micro-Bit leds on/off with the M5, create your own smilies on the M5.. ect..

      0_1577130117472_IMG_20191223_203318.jpg

      Here is the Micro-Bit code ;

      0_1577130157915_Image1.jpg

      And te M5Stack code ;

      
      
      #include <M5Stack.h>
      #include <M5StackUpdater.h>
      
      #define WIDTH 320
      #define HEIGHT 240
      #define BLOCK_SIZE  40
      #define UNIT_WIDTH  5
      #define UNIT_HEIGHT 5
      #define UNIT_SIZE 25
      #define GETX(i) ((i) % (5))
      #define GETY(i) ((i) / (5))
      int world[UNIT_SIZE];
      int i;
        
      void setup() {
        M5.begin();
        Wire.begin();
        if(digitalRead(BUTTON_A_PIN) == 0){
          Serial.println("Will load menu binary");
          updateFromFS(SD);
          ESP.restart();
        }
        Serial2.begin(115200, SERIAL_8N1, 16, 17);
        M5.Lcd.fillScreen(BLACK);
        M5.Lcd.setTextSize(2);
        M5.Lcd.setCursor(35, 220);  
        M5.Lcd.println("  <       *       >");  
          for (i = 0; i < UNIT_SIZE; i++) {
          world[i] = 0;
        }
        i = UNIT_SIZE / 2;
      }
      
      void loop() {
            M5.update();
            int x = GETX(i) + 1;
            int y = GETY(i);
            if (world[i] > 0) M5.Lcd.fillRect(x * BLOCK_SIZE + 1, y * BLOCK_SIZE + 1, BLOCK_SIZE - 2, BLOCK_SIZE - 2, LIGHTGREY);
            else M5.Lcd.fillRect(x * BLOCK_SIZE + 1, y * BLOCK_SIZE + 1, BLOCK_SIZE - 2, BLOCK_SIZE - 2, BLUE);
            if (M5.BtnC.wasPressed()) {
               if (world[i] > 0) M5.Lcd.fillRect(x * BLOCK_SIZE + 1, y * BLOCK_SIZE + 1, BLOCK_SIZE - 2, BLOCK_SIZE - 2, WHITE);
               else M5.Lcd.fillRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, BLACK);
               ++i;
               if (i >= UNIT_SIZE) i=0;
            }
            if (M5.BtnA.wasPressed()) {
               if (world[i] > 0) M5.Lcd.fillRect(x * BLOCK_SIZE + 1, y * BLOCK_SIZE + 1, BLOCK_SIZE - 2, BLOCK_SIZE - 2, WHITE);
               else M5.Lcd.fillRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, BLACK);
               --i;
               if (i < 0 ) i=UNIT_SIZE -1;
            }
            if (M5.BtnB.wasPressed()) {
              if (world[i] > 0) world[i]=0;
              else world[i]=1;
              Serial2.print(world[i]);
              Serial2.print(GETX(i));
              Serial2.println(GETY(i));
            }
      }
      

      On the M5; button A moves left, button C moves right and button B toggles the led, this shows on Micro-Bit and M5

      posted in PROJECTS
      ChrisWR
    • RE: M5-bit (Micro-Bit) part 2

      @ajb2k3 0_1577665242771_Image1.jpg
      0_1577665257165_Image2.jpg
      0_1577665274871_Image3.jpg

      posted in PROJECTS
      ChrisWR
    • RE: How could I make text to speech using the speaker?

      Try this for the M5stickC could work, ...

      #include <M5StickC.h>
      #include <Arduino.h>
      #include <ESP8266SAM.h>  //https://github.com/earlephilhower/ESP8266SAM
      #include <AudioOutputI2S.h>  //https://github.com/earlephilhower/ESP8266Audio
      
      AudioOutputI2S *out = NULL;
      
      void setup()
      { 
        out = new AudioOutputI2S(0, 1, 32);
        out->begin();
      }
      
      void loop()
      {
        ESP8266SAM *sam = new ESP8266SAM;
        sam->Say(out, "Can you hear me now?");
        delay(500);
        sam->Say(out, "I can't hear you!");
        delete sam;
      }
      
      posted in SOFTWARE
      ChrisWR