رفتن به مطلب
  • advertisement_alt
  • advertisement_alt
  • advertisement_alt

راه اندازی استپر موتور با esp32


Garooc
 اشتراک گذاری

ارسال های توصیه شده

من یک کد راه‌اندازی موتور dc با درایور l298n برای esp32 دارم. به خاطر نوع طراحی بدنه، مجبورم از استپر موتور 28byj-48 و درایور uln2003 استفاده کنم. نمیدونم چه تغییراتی توی کد باید انجام بدم. کد برای platformIO نوشته شده. اینجا اجازه آپلود کد رو نمیده. کسی میتونه منو راهنمایی کنه؟

لینک به دیدگاه
به اشتراک گذاری در سایت های دیگر

openapi: 3.1.0
info:
  title: Winderoo API
  version: 1.0.0
servers:
  - url: http://winderoo.local/api/
    description: local development and deployed devices
tags:
  - name: Status
    description: Retrieve the current state of Winderoo
  - name: Modify
    description: Modify the state of Winderoo
paths:
  /timer:
    post:
      tags:
        - Modify
      summary: Change the timer state of Winderoo
      parameters:
        - in: query
          name: timerEnabled
          schema:
            type: integer
          description: Whether Winderoo should enable alarm-start winding; number represents a boolean where 0 == off and 1 == on.
          example: 1
      responses:
        '204':
          description: Successful opeation
        '400':
          description: Missing required field in request body
          content:
            text/plain:
              schema:
                type: string
                examples: 
                  - "Missing required field: 'tpd'"
        '500':
          description: Something went wrong when writing to memory or during deserialization
          content:
            text/plain:
              schema:
                type: string
                examples:
                  - Failed to deserialize request body
  /update:
    post:
      tags:
        - Modify
      summary: Change the state of Winderoo
      requestBody:
        $ref: '#/components/requestBodies/UpdateBody'
      responses:
        '204':
          description: Successful opeation
        '400':
          description: Missing required field in request body
          content:
            text/plain:
              schema:
                type: string
                examples: 
                  - "Missing required field: 'tpd'"
        '500':
          description: Something went wrong when writing to memory or during deserialization
          content:
            text/plain:
              schema:
                type: string
                examples:
                  - Failed to deserialize request body
  /status:
    get:
      tags:
        - Status
      summary: Get the current status of Winderoo
      responses:
        '200':
          description: Service is alive with current winder state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Status'
  /power:
    post:
      tags:
        - Modify
      summary: Toggle whether Winderoo is on or off (hard off state)
      requestBody:
        $ref: '#/components/requestBodies/PowerBody'
      responses:
        '204':
          description: State toggled succesfully
        '400':
          description: Missing required field in request body
          content:
            text/plain:
              schema:
                type: string
                examples: 
                  - "Missing required field: 'winderEnabled'"
        '500':
          description: Something went wrong when writing to memory or during deserialization
          content:
            text/plain:
              schema:
                type: string
                examples: 
                  - Failed to deserialize request body
  /reset:
    get:
      tags:
        - Modify
      summary: Resets Winderoo's network settings; re-initializes winderoo with setup access point
      responses:
        '200':
          description: State toggled succesfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resetting'
components:
  requestBodies:
    UpdateBody:
      description: a JSON object containing winderoo information
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Update'
          example:
            tpd: "330"
            hour: "14"
            minutes: "50"
            timerEnabled: "0"
            action: "START"
            rotationDirection: "BOTH"
            screenSleep: false
    PowerBody:
      description: a JSON object containing winderoo power information
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Power'
          example:
            winderEnabled: "1"
  schemas:
    Power:
      type: object
      propertries:
        winderEnabled:
          type: string
          description:
            Whether Winderoo should enable alarm-start winding; number represents a boolean where 0 == off and 1 == on.
          examples:
            - 0
            - 1
    Update:
      type: object
      propertries:
        tpd:
          type: string
          description: how many turns are required
          examples:
            - 330
        hour:
          type: string
          description: At what hour winderoo should begin winding at
          examples:
            - 14
        minutes:
          type: string
          description: At what minute winderoo should begin winding at
          examples:
            - 50
        timerEnabled:
          type: string
          description:
            Whether Winderoo should enable alarm-start winding; number represents a boolean where 0 == off and 1 == on.
          examples:
            - 0
            - 1
        action:
          type: string
          description: Whether Winderoo should start or stop winding
          examples:
            - START
            - STOP
        rotationDirection:
          type: string
          description: The winding direction
          examples:
            - CW
            - CCW
            - BOTH
    Status:
      type: object
      properties:
        status:
          type: string
          examples: 
            - Stopped
        rotationsPerDay:
          type: string
          examples:
            - 300
        direction:
          type: string
          examples:
            - BOTH
        hour:
          type: string
          examples:
            - 12
        minutes:
          type: string
          examples:
            - 50
        durationInSecondsToCompleteOneRevolution:
          type: number
          examples:
            - 8
        startTimeEpoch:
          type: number
          examples:
            - 0
        currentTimeEpoch:
          type: number
          examples:
            - 1680555863
        estimatedRoutineFinishEpoch:
          type: number
          examples:
            - 0
        winderEnabled:
          type: string
          examples:
            - 1
        timerEnabled:
          type: string
          examples:
            - 1
        db:
          type: number
          examples:
            - -67
        screenSleep:
          type: boolean
          examples:
            - false
        screenEquipped:
          type: boolean
          examples:
            - false
    Resetting:
      type: object
      properties:
        status:
          type: string
          examples:
            - Resetting

کد با نام openapi.yml

لینک به دیدگاه
به اشتراک گذاری در سایت های دیگر

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
description = IoT controlled smart watch winder

[env:esp32doit-devkit-v1]
platform = espressif32@^5.2.0
board = esp32doit-devkit-v1
framework = arduino
upload_speed = 115200
monitor_speed = 115200
build_src_filter = +<*> -<./angular/>
board_build.filesystem = littlefs
check_tool = cppcheck, clangtidy
build_flags =
	-D OLED_ENABLED=false
check_flags = 
	clangtidy: -fix-errors,--format-style=google
lib_deps = 
	esphome/AsyncTCP-esphome@^1.2.2
	esphome/ESPAsyncWebServer-esphome@^2.1.0
	Wire
	https://github.com/tzapu/WiFiManager.git
	https://github.com/bblanchon/ArduinoJson.git
	fbiego/ESP32Time@^2.0.0
	adafruit/Adafruit SSD1306@^2.5.9

کد با نام platformio.ini

لینک به دیدگاه
به اشتراک گذاری در سایت های دیگر

برای ارسال دیدگاه یک حساب کاربری ایجاد کنید یا وارد حساب خود شوید

برای اینکه بتوانید دیدگاهی ارسال کنید نیاز دارید که کاربر سایت شوید

ایجاد یک حساب کاربری

برای حساب کاربری جدید در سایت ما ثبت نام کنید. عضویت خیلی ساده است !

ثبت نام یک حساب کاربری جدید

ورود به حساب کاربری

دارای حساب کاربری هستید؟ از اینجا وارد شوید

ورود به حساب کاربری
 اشتراک گذاری

×
×
  • اضافه کردن...