'While running wiringpi python program motors are not initializing

I am trying to use python wiringpi for self-driving car core code.

import wiringpi as wp
from time import sleep

in1 = 1
in2 = 4
in3 = 5
in4 = 6

def initDC():
    wp.pinMode(in1, 1)
    wp.pinMode(in2, 1)
    wp.pinMode(in3, 1)
    wp.pinMode(in4, 1)
    wp.digitalWrite(in1, 1)
    wp.digitalWrite(in1, 1)
    wp.digitalWrite(in1, 1)
    wp.digitalWrite(in1, 1)
    print("initDC")

def goForward():
    wp.digitalWrite(in1, 1)
    wp.digitalWrite(in1, 0)
    wp.digitalWrite(in1, 1)
    wp.digitalWrite(in1, 0)
    print("goForward")

wp.wiringPiSetup()
initDc()
goForward()
sleep(1)

I installed wiringpi using pip. It installed successfully.

While I am running this code via terminal it is executing printing but motors are not turning on and working?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source