From 3a00107a4a880e60201058170ba457fc375de39c Mon Sep 17 00:00:00 2001 From: Arghya Biswas Date: Sun, 10 Aug 2025 13:24:33 +0530 Subject: [PATCH] add motor control Signed-off-by: Arghya Biswas --- Script/main.py | 19 ++++++++++++++----- Script/pinDescription.py | 4 +++- config.yaml | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Script/main.py b/Script/main.py index 81c266d..ad5b019 100644 --- a/Script/main.py +++ b/Script/main.py @@ -50,8 +50,8 @@ def startIntroPrint(): time.sleep(1) -# This is the gpio initlization -def gpioInilitization(): +# This is the gpio initialization +def gpioInitialization(): gpio.pinMode(ON_BOARD_LED_PIN, OUTPUT) gpio.pinMode(GPIO_3V3_1_PIN, OUTPUT) gpio.pinMode(GPIO_3V3_2_PIN, OUTPUT) @@ -65,6 +65,8 @@ def gpioInilitization(): gpio.pinMode(POSITION_MIDDLE_LED_PIN, OUTPUT) gpio.pinMode(POSITION_LEFT_LED_PIN, OUTPUT) + gpio.pinMode(MOTOR_ON_OFF_PIN, OUTPUT) + gpio.pinMode(RESET_PUSH_SWITCH_PIN, INPUT) gpio.digitalWrite(GPIO_3V3_1_PIN, HIGH) @@ -74,6 +76,8 @@ def gpioInilitization(): gpio.digitalWrite(POSITION_MIDDLE_LED_PIN, LOW) gpio.digitalWrite(POSITION_LEFT_LED_PIN, LOW) + gpio.digitalWrite(MOTOR_ON_OFF_PIN, LOW) + # Time print function def printCurrentTime(row: int): @@ -118,10 +122,10 @@ def setup(): startIntroPrint() print("Intro print done!") - gpioInilitization() - print("GPIO initilization done!") + gpioInitialization() + print("GPIO initialization done!") createRtDbFile() - print("Dabase creation done!") + print("Database creation done!") lcd.write("Model: Type-D", row = ROW_NO_1, center = True) @@ -187,6 +191,7 @@ def loop(): global lastDebounceTime while True: + gpio.digitalWrite(MOTOR_ON_OFF_PIN, HIGH) printCurrentTime(ROW_NO_0) ################################################# @@ -253,6 +258,9 @@ def loop(): # If reach the full count number then turn on the Finish LED if cycleCounter >= TotalCounter: gpio.digitalWrite(ON_BOARD_LED_PIN, HIGH) + gpio.digitalWrite(MOTOR_ON_OFF_PIN, LOW) + lcd.write("Count Finished!", row = ROW_NO_3, padding = True) + print("Count Finished!") cycleCounter = 0 # Reset button debounce logic @@ -273,6 +281,7 @@ def loop(): # If reset button pressed then clean the old stuffs if ResetTrigger: + gpio.digitalWrite(MOTOR_ON_OFF_PIN, LOW) cycleCounter = 0 gpio.digitalWrite(ON_BOARD_LED_PIN, LOW) setCycleCount(cycleCounter) diff --git a/Script/pinDescription.py b/Script/pinDescription.py index ef5e709..6bf853c 100644 --- a/Script/pinDescription.py +++ b/Script/pinDescription.py @@ -9,9 +9,11 @@ RESET_PUSH_SWITCH_PIN = 37 +MOTOR_ON_OFF_PIN = 32 + ON_BOARD_LED_PIN = 36 GPIO_3V3_1_PIN = 38 GPIO_3V3_2_PIN = 40 -LCD_MODULE_ADDRESS = 0x27 +LCD_MODULE_ADDRESS = 0x27 diff --git a/config.yaml b/config.yaml index 3fc0bc9..613ca3e 100644 --- a/config.yaml +++ b/config.yaml @@ -1,2 +1,2 @@ -appVersion: 1.7.4.1014 +appVersion: 1.8.0.1015 maxCount : 7500000