Two Pin Motor Driver Sample Code - Raspberry Pi RoboPi User Manual

Hide thumbs Also See for RoboPi:
Table of Contents

Advertisement

RoboPi v1.00

Two pin motor driver sample code

#include <stdio.h>
#include "RoboPiLib.h"
#define MOTORA_IA
#define MOTORA_IB
#define MOTORB_IA
#define MOTORB_IB
int main(int argc, char *argv[]) {
int i;
RoboPiInit("/dev/ttyAMA0",115200);
while(1) {
// set both motors FORWARD
pinMode(MOTORA_IA,PWM);
pinMode(MOTORA_IB,OUTPUT);
digitalWrite(MOTORA_IB,0);
pinMode(MOTORB_IA,PWM);
pinMode(MOTORB_IB,OUTPUT);
digitalWrite(MOTORB_IB,0);
for(i=0;i<256;i+=16) {
analogWrite(MOTORA_IA, i);
analogWrite(MOTORB_IA, i);
sleep(1);
}
http://Mikronauts.com
User Manual v0.85
12
13
14
15
Copyright 2014 William Henning
24
2014-01-27

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RoboPi and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents