Initial Home page
16
Mk1-code-example.md
Normal file
16
Mk1-code-example.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
To best describe usage of the 640 Mk1 board, I'll paste the test script I put together and go through each section (Mk2 will be different to this, slightly).
|
||||||
|
|
||||||
|
The first thing to do is to grab the 640Mk1 repository (or the https://github.com/adafruit/Adafruit-Motor-HAT-Python-Library) - the code in the main class isn't complete yet (or tested / debugged) but we're primarily after the Adafruit I2C and PWM modules for this example.
|
||||||
|
|
||||||
|
Put the files **Adafruit_I2C.py** and **Adafruit_PWM_Servo_Driver.py** in your project directory (or path), then create a new file and populate it with the following:
|
||||||
|
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time
|
||||||
|
from Adafruit_PWM_Servo_Driver import PWM
|
||||||
|
|
||||||
|
Grab the required modules
|
||||||
|
|
||||||
|
pwm = PWM( 0x60, debug=False)
|
||||||
|
pwm.setPWMFreq(1600)
|
||||||
|
|
||||||
|
Set up the PWM address and frequency
|
||||||
Reference in New Issue
Block a user