viewtopic.php?f=44&t=114266&p=781376#p781376
I have connected my Model B Rev 2 that I have successfully connected to an Arduino Nano ATMega328 via i2c.
Using information from several sites I have set the Arduino as a Slave and have a Python Code to turn on and off the onboard LED on the Nano.
I now want to turn on and off a Motor connected via an L298N Motor Driver Board (See guide linked below) but this is where I am stuck.
According to this guide:
http://tronixlabs.com/news/tutorial-l29 ... d-arduino/
To turn on a motor you need to turn 2 'in' pins High or Low (Backwards or Forwards) and send either a PWM command to the respective 'en' pins (enA or enB).
The L298N has a 7.4v LiPo connected to pin 4 and the Nano is powered using the 5v from the L298N pin 6.
Can anyone help with the corrrect commands in python to be sent over i2c?
Pinouts for the code below are:
Nano - L298N
08 - in1
07 - in2
11 - enA
There are two motor connected to pin 1 and 2 / 13 and 14
I have tried:
Code: Select all
setPin(33, "08", "Output") #on Arduino with I2C ID #33 set pin 08 to OUTPUT
setPin(33, "07", "Output") #on Arduino with I2C ID #33 set pin 07 to OUTPUT
setPin(33, "11", "Output")
writePin(33,"08", "Low") #on Arduino with I2C ID #33 set pin 08 HIGH
writePin(33,"07", "High") #on Arduino with I2C ID #33 set pin 07 HIGH
writePin(33,"11", "High") #on Arduino with I2C ID #33 set pin 07 HIGH
# analogWritePin(33, "11", 245): #on Arduino with I2C ID #33 set PWM on pin 11 to 245
Code: Select all
setPin(33, "08", "Output") #on Arduino with I2C ID #33 set pin 08 to OUTPUT
setPin(33, "07", "Output") #on Arduino with I2C ID #33 set pin 07 to OUTPUT
setPin(33, "11", "Output")
writePin(33,"08", "Low") #on Arduino with I2C ID #33 set pin 08 HIGH
writePin(33,"07", "High") #on Arduino with I2C ID #33 set pin 07 HIGH
# writePin(33,"11", "High") #on Arduino with I2C ID #33 set pin 07 HIGH
analogWritePin(33, "11", "245"): #on Arduino with I2C ID #33 set PWM on pin 11 to 245But neither seems to work.
