Navigation

    M5Stack Community

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

    sbollaerts

    @sbollaerts

    0
    Reputation
    1
    Posts
    1001
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    sbollaerts Follow

    Posts made by sbollaerts

    • analogRead on M5Atom

      Hello, I'm trying to make analog readings on pin "G33" and "G23".

      • When I do analogRead(33), I get the same values whatever I send the signal on G33 or G23
      • When I do analogRead(23), I receive no signal on G33 and G23

      What am I missing?

      #if !defined(ARDUINO_M5Stick_C)
      #error Wrong target platform (M5StickC - M5Atom)
      #endif

      #include "M5Atom.h"
      #include "pixelTypes.h"

      uint8_t pinNorth = 33;
      //uint8_t pinSouth = 19;

      void setup()
      {
      M5.begin(false, false, true);
      Serial.begin(115200);
      }

      void loop()
      {
      int readValue;
      int ledValue;

      // Read the North pin
      readValue = analogRead(pinNorth);
      ledValue = map(readValue, 0, 4095, 0, 255);
      Serial.print("- North: ");
      Serial.print(readValue);
      Serial.print(" -> ");
      Serial.println(ledValue);

      M5.dis.drawpix(2, ledValue);
      M5.dis.drawpix(6, ledValue);
      M5.dis.drawpix(7, ledValue);
      M5.dis.drawpix(8, ledValue);

      delay(10);

      // Read the South pin
      // readValue = analogRead(pinSouth);
      // ledValue = map(readValue, 0, 4095, 0, 255);
      //
      // Serial.print("- South: ");
      // Serial.print(readValue);
      // Serial.print(" -> ");
      // Serial.println(ledValue);
      //
      // M5.dis.drawpix(16, ledValue);
      // M5.dis.drawpix(17, ledValue);
      // M5.dis.drawpix(18, ledValue);
      // M5.dis.drawpix(22, ledValue);
      //
      // Serial.println("");
      // delay(10);
      }

      posted in Atom
      S
      sbollaerts