das sind nur kleine bibs die einen roboter fahren lassen, denke das sollte gehen?
Code:
// include this library's description file
#include "Shieldbot.h"
#define right1 D5 //define I1 interface
#define speedPinRight D6 //enable right motor (bridge A)
#define right2 D7 //define I2 interface
#define left1 D8 //define I3 interface
#define speedPinLeft D9 //enable motor B
#define left2 D10 //define I4 interface
int speedmotorA = 255; //define the speed of motorA
int speedmotorB = 255; //define the speed of motorB
void Shieldbot::motor()
{
DigitalOut right1(D5);
DigitalOut speedPinRight(D6);
DigitalOut right2(D7);
DigitalOut left1(D8);
DigitalOut speedPinLeft(D9);
DigitalOut left2(D10);}
Code:
// ensure this library description is only included once
#ifndef Shieldbot_h
#define Shieldbot_h
// include types & constants of Wiring core API
#include "mbed.h"
// library interface description
class Shieldbot
{
public:
void motor();
};
#endif
Lesezeichen